Showing posts with label drupal. Show all posts
Showing posts with label drupal. Show all posts

Wednesday, September 12, 2012

Drupal: Webservice data cannot display in portal

Case:
We using php code to display webservice(.wsdl) data in drupal portal. But failed.. we get blank page. What happen??

Solution:

  1. Check application log in portal server
    # tail -f /data/log/httpd-error.log
  2. Increase max_execution_time limit in php.ini
    max_execution_time = 500
  3. Increase memory_limit in php.ini
    memory_limit= 512M
  4. Restart apache
    # /etc/rc.d/apache2  restart


    .

Monday, May 14, 2012

Drupal: Clean URL Error after migrate to Ubuntu Server


Clean URLs with Apache 2 on Ubuntu

Step 1 - Method A: "Virtual Host" Setup

First, from the Linux command line, enable the rewrite module for apache with this command:
sudo a2enmod rewrite
You can check to see if this worked by running:
apache2ctl -M
and seeing if it is on the list.
Next, use an editor (such as nano) to edit the appropriate Apache configuration file for your Drupal site in the /etc/apache2/sites-available/ directory. For a single site, the file is /etc/apache2/sites-available/default; if you have multiple sites, the file names should reflect the names of the sites to which they refer. Thus, to edit the default site configuration, use
sudo nano /etc/apache2/sites-available/default
Look for the Directory section referring to the folder where your Drupal site lives (in /etc/apache2/sites-available/default, this is typically ), and change the line:
AllowOverride None to AllowOverride All
(This directive permits an .htaccess file, such as Drupal's, to be used to override Apache's default settings, and is necessary to allow the URL rewriting to work. Seehttps://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles for more information).
Save this file and then reload Apache as follows:
sudo /etc/init.d/apache2 reload

Subdomain Setup

Instead of creating multiple virtual host files, you can create one virtual host file that uses a wildcard in the ServerAlias. Both a simple multi-site Drupal setup and multiple Drupal versions can run this way, if the different subdomains are defined for each site in settings.php.
Consider the following and modify your configuration file to fit your needs.
  1. http://myproject.dr5.example/
  2. http://myproject.dr6.example/
  3. http://myproject2.dr6.example/
Here is a partial listing of a virtual host configuration file that would support the last two lines in the above example. Note this is not intended to be a COMPLETE configuration file, but rather provide guidance for your development setup.

DocumentRoot "/www/Dr6"
ServerName example
ServerAlias *.dr6.example


AllowOverride All
Edit & save your config file to suit your development needs. Assuming the site is already enabled, then reload Apache.

Step 1Method B: apache2.conf

In Apache version 2, httpd.conf has been deprecated and the new file is located at:
/etc/apache2/apache2.conf.
Thus, it's no longer necessary to do the following in httpd.conf to enable the rewrite module (mod_rewrite):
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
Simply run the following from the Linux command line:
sudo a2enmod rewrite
To disable the module you can run:
sudo a2dismod rewrite
(**Note that this would cause clean URLs to break.)
Once mod_rewrite is enabled, open apache2.conf in a text editor. Note that it will probably be read-only, so you will need sudo privileges to edit it. Use a command such as:
sudo nano /etc/apache2/apache2.conf
Find where the sections are in your apache2.conf and add another one for your Drupal site similar to this:

    AllowOverride All
After you edit apache2.conf as listed above, you need to restart the server by:
sudo /etc/init.d/apache2 reload

Step 1 - Method C: Add Rewrite Rules Directly to Virtual Host or apache2.conf

If you do not wish to allow .htaccess overrides, you can add the rewrite rules directly to a virtual host file or apache2.conf. The following should work:

         RewriteEngine On
         RewriteBase /
         RewriteCond %{REQUEST_FILENAME} !-f
         RewriteCond %{REQUEST_FILENAME} !-d
         RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
     
This can provide slightly faster server performance since Apache will not look in every directory for an .htaccess file.
Note that, for proper security, you will need to add in the rules from the Drupal files directory's .htaccess file as well.
More info >> http://drupal.org/node/134439





Friday, March 2, 2012

Drupal: Multilingual- Translate Home Link Setting

About one week we try to translate Home link , but still have issue that both language appear together in main menu navigation. But today we just got idea to create the home link from the main page, insteed of using default front page setting.

How to do?
  1. Disable Home in main menu list link.
  2. Go to main page, let say page name: main  (in  URL path settings )
  3. Edit the page
  4. Go to English first  > Menu Settings  > Thick Provide a menu link
  5. Set  Menu link title: Home    and   Save.
  6. Go to Translate to Arabic page   >  Edit for Arabic language
  7. Menu Settings  > Thick Provide a menu link
  8. Set  Menu link title: Ø§Ù„رئيسية   and   Save.
  9. Make sure URL path settings  > Set   Alias: welcome
  10. Refresh the site and check back the main menu navigation.
  11. The new Home menu will appear accordingly to your chosen language.
How to arrange Home menu to be the first in list?
  1. Go to Structure  >  Menus  >  Main Menu   >  List links
  2. You can arrange the weight or drag the link based on me menus priority rank.
  3. Thats it!
Good Luck.

Thursday, February 24, 2011

Drupal: How to enable Clean Urls Module

  1. Edit apache configuration
    ee /usr/local/etc/apache22/httpd.conf

    and set
    AllowOverride All

  2. Make sure
    LoadModule rewrite_module modules/mod_rewrite.so

    is enable.

  3. Edit .htaccess file and change

    # RewriteBase /

    to
    RewriteBase /

  4. Restart Server


Another way

If you have locked yourself out, visit http://example.com/?q=user just like you do to re-enable offline sites. You can log in there, enough to become admin, although none of the navigation will work yet.

Next, enter http://example.com/?q=admin/settings/clean-urls (in DRUPAL 5 and 6) to view the page where you can unset clean URLs.
Your interface will be usable again.

Other options that should get the same result include:

  • Run the drush commands:
    drush vset clean_url 1 --yes

  • Run the mysql commands:
    UPDATE variable SET value = 's:1:"0";' WHERE name = 'clean_url';
    DELETE FROM cache;

  • Alternatively, you can modify the appropriate settings.php file to include the line
    $conf['clean_url'] = 0;
    at the bottom (or similar code in the site settings array you'll see there).

    .

Monday, February 7, 2011

How to enable HTTPS support in Drupal

Web server configuration

  1. Get a certificate. many hosting providers set these up for you - either automatically or for a fee. Simply ask your hosting provider.

  2. Configure your web server. A few helpful links:

    Chances are, your webhost will do this for you if you are on shared hosting.

Drupal configuration

  • If you want to support mixed-mode HTTPS and HTTP sessions open up sites/default/settings.php and add $conf['https'] = TRUE;.
    This enables you use the same session over HTTP and HTTPS both -- but with two cookies where the HTTPS cookie is sent over HTTPS only. You will need to use contributed modules like securepages to do anything useful with this mode, like submitting forms over HTTPS and so on. While your HTTP cookie is still vulnerable to all usual attacks, a hijacked insecure session cookie can only be used to gain authenticated access to the HTTP site. It will not be valid on the HTTPS site. Whether this is a problem or not depends on the needs of your site and the various module configurations. For example, if all forms are set to go through HTTPS and your visitors can see the same information as logged in users then this is not a problem.

  • For even better security, leave $conf['https'] at the default value (FALSE) and send all authenticated traffic through HTTPS and use HTTP for anonymous sessions. Once again contributed modules like Secure Login can help you here. Drupal 7 automatically enables the session.cookie_secure PHP configuration on HTTPS sites, which causes SSL-only secure session cookies to be issued to the browser.

  • For best-possible security, setup your site to only use HTTPS, not even responding to HTTP with a redirect. HTTPS is vulnerable to man-in-the-middle attacks if the connection starts out as a HTTP connection before being redirected to HTTPS. $conf['https'] can be left at its default value (FALSE) on pure-HTTPS sites.

    .

Tuesday, August 31, 2010

How to upgrade Drupal 6.15 to 6.19 ?

Updated patch files to Drupal 6.18/6.19

Standard procedure to upgrade Drupal:

  1. Download the latest release/patch from drupal.org and follow the included UPGRADE.txt.
    **However,for administrators using the UNIX shell it may be easier using the attached patch files below instead of downloading and installing the newest complete Drupal release.

  2. Download the related patch files from here:
    http://fuerstnet.de/en/drupal-upgrade-easier

  3. Follow UPGRADING.txt up to '5'.
    Let's begin!

    1. Back up your Drupal database and site root directory. Be especially sure to back up your "sites" directory which contains your configuration file, added modules and themes, and your site's uploaded files. If other files have modifications, such as .htaccess or robots.txt, back those up as well.

    Note: for a single site setup, the configuration file is the "settings.php" file located at sites/default/settings.php. The default.settings.php file contains a clean copy for restoration purposes, if required.

    For multisite configurations, the configuration file is located in a
    structure like the following:

    sites/default/settings.php
    sites/example.com/settings.php
    sites/sub.example.com/settings.php
    sites/sub.example.com.path/settings.php


    More information on multisite configuration is located in INSTALL.txt.

    2. If possible, log on as the user with user ID 1, which is the first account created and the main administrator account. User ID 1 will be able to automatically access update.php in step #10. There are special instructions in step #10 if you are unable to log on as user ID 1. Do not close your browser until the final step is complete.

    3. Place the site in "Off-line" mode, to let the database updates run without interruption and avoid displaying errors to end users of the site. This option is at http://www.example.com/?q=admin/settings/site-maintenance (replace www.example.com with your installation's domain name and path).

    4. If using a custom or contributed theme, switch to a core theme, such as Garland or Bluemarine.

    5. Disable all custom and contributed modules.


  4. Remove all of the old files and directories from the Drupal installation directory." Go on using this commands:
    • cd DRUPAL-ROOT
    • Patch: patch -p1 <>
      * Be warned: this may break your Drupal installation , so make sure to have a backup at hand.

  5. Proceed with UPGRADING.txt from '8'. Verify the new configuration file to make sure it has the latest and correct information.

    8. Copy your backed up "files" and "sites" directories to the Drupal installation directory. If other system files such as .htaccess or robots.txt were customized, re-create the modifications in the new versions of the files using the backups taken in step #1.

    9. Verify the new configuration file to make sure it has correct information.

    10. Run update.php by visiting http://www.example.com/update.php (replace www.example.com with your Drupal installation's domain name and path). This step will update the core database tables to the new Drupal installation.

    Note: if you are unable to access update.php do the following:

    - Open your settings.php with a text editor.

    - There is a line that says $update_free_access = FALSE;
    Change it to $update_free_access = TRUE;

    - Once update.php is done, you must change the settings.php file
    back to its original form with $update_free_access = FALSE;

    11. Ensure that the versions of all custom and contributed modules match the new Drupal version to which you have updated. For a major update, such as from 5.x to 6.x, modules from previous versions will not be compatible and updated versions will be required.

    - For contributed modules, check http://drupal.org/project/modules for the version of a module matching your version of Drupal.

    - For custom modules, review http://drupal.org/update/modules to ensure that a custom module is compatible with the current version.

    12. Re-enable custom and contributed modules and re-run update.php to update custom and contributed database tables.

    13. Return the site to its original theme (if you switched to a core theme like Garland or Bluemarine in step #4). If your site uses a custom or contributed theme, make sure it is compatible with your version of Drupal.

    - For contributed themes, check http://drupal.org/project/themes for the version of a theme matching your version of Drupal.

    - For custom themes, review http://drupal.org/update/theme to ensure that a custom theme is compatible with the current version.

    14. Finally, return your site to "Online" mode so your visitors may resume browsing. As in step #3, this option is available in your administration screens at http://www.example.com/?q=admin/settings/site-maintenance (replace www.example.com with your installation's domain name and path).

    **
    Warning

    If you get errors like Reversed (or previously applied) patch detected or 1 out of 2 hunks FAILED while running the patch dry run (second command above) immediately interrupt patching and upgrade following the steps explained in UPGRADING.txt.


Reference Source:
http://fuerstnet.de/en/drupal-upgrade-easier

.

Monday, February 1, 2010

HOW TO PATCH Drupal 6.14 to Drupal 6.15

In first place, I try to upgrade my drupal follow the instruction in UPGRADE.txt.. but not successful. I try three time and at last I fade up.

Finally I found this easier way to patch Drupal 6.14 to Drupal 6.15. This case is for Unix based server only.

Just Follow this simple steps;

  1. Backup your drupal database and file system first. Store your backup in other folder(/home/user/)

  2. Download patch file (drupal-6.14-to-6.15.patch ) from this site
    http://fuerstnet.de/en/drupal-upgrade-easier

  3. Open your drupal directory
    #cd your drupal directory

  4. Copy the patch file (drupal-6.14-to-6.15.patch ) into this directory.

  5. Login to drupal admin page. Please login as admin.

  6. Set site to off-line mode. Disable all modules that currently enable.

  7. Run this pact command:
    #patch -p1 < drupal-6.14-to-6.15.patch

    ** Be warned: this may break your Drupal installation so make sure to have a backup at hand.

  8. After finished, Verify the new configuration file to make sure it has the latest and correct information.

  9. Run http://your domain/update.php

  10. After finished, Verify in status report page to make sure your Drupal already upgrade to version 6.15.

  11. Enable back all previous active modules.

  12. Set the site back to online mode. See the site live again.

    Good luck!

    * Use this patch files on your own responsibility. I don't guarantee the proper function of the patch files on Drupal installations other than my own. - fuerstnet.de

.

Thursday, December 3, 2009

How to patch Drupal 6.x to 6.y?

Upgrading from previous versions

Notes:
  1. It is best practice to back up your Drupal files and database(s) before upgrading.
  2. Two major versions of Drupal are supported at a time. 6.x is the current version. 5.x is the prior version and is still supported. Drupal 4.x is unsupported.
  3. Knowing what version to upgrade to:
    • If upgrading from one minor release to another, such as 6.3 to 6.14, jump straight to the latest release within that major version.
    • If upgrading from one major version to another, such as from 4.6 to 6.14, you must upgrade to the latest release within the major version (4.7), then the latest release within the next major version (5.20), etc. until you're at the latest release of the final major version
    • More upgrade information is available at:
      1. The UPGRADE.txt file packaged with your Drupal files.
      2. Release announcements for the version to which you're upgrading (e.g. http://drupal.org/drupal-6.2 for Drupal 6.2). Check the release pages of earlier versions if you must upgrade to them first (e.g., upgrading from 4.6 to 6.20--see above).
      3. Other pages of this handbook section.

References:

UPGRADE DRUPAL 6.9 to 6.14
~~~~~~~~~~~~~~~~~~~~~~~~

Let's begin!

1. Backup your database and Drupal directory - especially your "sites"
directory which contains your configuration file and added modules and
themes, any contributed or custom modules in your "modules" directory,
and your "files" directory which contains uploaded files. If other files
have modifications, such as .htaccess or robots.txt, those should be
backed up as well.

Note: for a single site setup, the configuration file is the "settings.php"
file located at sites/default/settings.php. The default.settings.php file
contains a clean copy for restoration purposes, if required.

For multisite configurations, the configuration file is located in a
structure like the following:

sites/default/settings.php
sites/example.com/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.path/settings.php

More information on multisite configuration is located in INSTALL.txt.

2. If possible, log on as the user with user ID 1, which is the first account
created and the main administrator account. User ID 1 will be able to
automatically access update.php in step #10. There are special instructions
in step #10 if you are unable to log on as user ID 1. Do not close your
browser until the final step is complete.

3. Place the site in "Off-line" mode, to let the database updates run without
interruption and avoid displaying errors to end users of the site. This
option is at http://www.example.com/?q=admin/settings/site-maintenance
(replace www.example.com with your installation's domain name and path).

4. If using a custom or contributed theme, switch
to a core theme, such as Garland or Bluemarine.

5. Disable all custom and contributed modules.

6. Remove all old files and directories from the Drupal installation directory.

7. Unpack the new files and directories into the Drupal installation directory.

8. Copy your backed up "files" and "sites" directories to the Drupal
installation directory. If other system files such as .htaccess or
robots.txt were customized, re-create the modifications in the new
versions of the files using the backups taken in step #1.

9. Verify the new configuration file to make sure it has correct information.

10. Run update.php by visiting http://www.example.com/update.php (replace
www.example.com with your Drupal installation's domain name and path). This
step will update the core database tables to the new Drupal installation.

Note: if you are unable to access update.php do the following:

- Open your settings.php with a text editor.

- There is a line that says $update_free_access = FALSE;
Change it to $update_free_access = TRUE;

- Once update.php is done, you must change the settings.php file
back to its original form with $update_free_access = FALSE;

11. Ensure that the versions of all custom and contributed modules match the
new Drupal version to which you have updated. For a major update, such as
from 5.x to 6.x, modules from previous versions will not be compatible
and updated versions will be required.

- For contributed modules, check http://drupal.org/project/modules
for the version of a module matching your version of Drupal.

- For custom modules, review http://drupal.org/update/modules to
ensure that a custom module is compatible with the current version.

12. Re-enable custom and contributed modules and re-run update.php
to update custom and contributed database tables.

13. Return the site to its original theme (if you switched to a core
theme like Garland or Bluemarine in step #4). If your site uses a
custom or contributed theme, make sure it is compatible with your
version of Drupal.

- For contributed themes, check http://drupal.org/project/themes
for the version of a theme matching your version of Drupal.

- For custom themes, review http://drupal.org/update/theme to ensure
that a custom theme is compatible with the current version.

14. Finally, return your site to "Online" mode so your visitors may resume
browsing. As in step #3, this option is available in your administration
screens at http://www.example.com/?q=admin/settings/site-maintenance
(replace www.example.com with your installation's domain name and path).

For more information on upgrading visit
the Drupal handbook at http://drupal.org/upgrade

See the tutorial video here.

.

Thursday, July 9, 2009

Drupal: Multilanguage

Content Translation
http://drupal.org/handbook/modules/translation

Local: Multilanguage Support
http://drupal.org/handbook/modules/locale

Translation for Download
http://drupal.org/project/Translations

Localization Server
http://drupal.org/project/l10n_server

Internationalization
http://drupal.org/project/i18n

Menu Translation
http://drupal.org/project/menutranslation

Active Translation Module
http://ftp.drupal.org/files/projects/active_translation-6.x-1.3.tar.gz

Consistent Language Interface
http://drupal.org/project/languageinterface

Module
:
http://ftp.drupal.org/files/projects/languageinterface-6.x-2.1.tar.gz


This module provides a language switching block that is very similar to that provided by the core locale module, however its behavior differs from the locale block in several ways:

1. The visibility of language links in the block is consistent and independent from the existence of translations for the page that you are viewing. The logic here is that the user should be able to change the language of the interface at all times. This is important because often there are menus and blocks that are language specific and the user should always be able to find the link back to their language.

*** For those who would like to have it so that languages which are not translated also do not have language links you should use the Language Icons module in conjunction with the core Locale module. ***




..

Tuesday, June 2, 2009

Drupal: How to hide/delete/display Page Title

First Case:

I need to hide/delete title Announcement .... in list of announcement page.

Solution:
  1. Go to sites/all/theme/yourtheme/views-view-unformatted.tpl.php
  2. Edit the php script.
  3. Save and refresh the page.
  4. See the changes.
*** To change format for announcement also in this file


Second Case:

I want to remain display page title in any particular page.

Solution:
  1. Go to sites/all/theme/yourtheme/page.tpl.php
  2. Edit the php script.
  3. Save and refresh the page.
  4. See the changes.

Drupal: Where to edit frontpage script

My case:

I want to add google analytic script in my main page in drupal.

Solution:
  1. Copy the google analytic script.
  2. Go to sites/all/theme/yourtheme/page-front.tpl.php
  3. Past the script before "close body" tag.
  4. Save and refresh the drupal main page.
  5. Right Click to see view source.
  6. Check that the google analytic script appear in the source page before "close body" tag.
  7. Finish.(Wait after 6 -24 hours to see the report)


Sunday, May 10, 2009

How to setup Drupal site in localhost?

Creating a test site on a local computer

It is considered a good practice to do all development work on a separate test site before making changes to a production site. A test site allows you to evaluate the impact of upgrades, new modules, modifications to themes etc. without causing disruption to your live site. For information about setting up a web server on a local computer, see the Local Server Setup section of the Developing for Drupal guide.

  1. Download Drupal.

    Drupal files, and associated modules, are compressed in the .tar.gz format and can be extracted using most compression tools.

    On a typical Unix command line, use:
    wget http://drupal.org/files/projects/drupal-x.x.tar.gz
    tar -zxvpf drupal-x.x.tar.gz

    This will create a new directory drupal-x.x/ containing all Drupal files and directories and will preserve all of Drupal's file and directory permissions. Move the contents of that directory into a directory within your web server's document root or your public HTML directory.

    mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html

    The base URL for your Drupal installation will be set in your Web server's configuration file. You will need to know this URL before proceeding to the next step of the installation. If you are installing Drupal on your local machine the base URL may be: http://localhost. If you are installing Drupal onto a Web server your base URL may be a specific domain name (such as http://example.com).

    Note for Windows users
    A number of compression programs, such as 7-Zip, allow you to extract .tar.gz files. To use 7-Zip, right-click on the .tar.gz file and, in the menu that appears, select 7-Zip -> Extract Here. A .tar file will appear. Right-click on the .tar file and again select 7-Zip -> Extract Here. In a few moments, the final Drupal folder will appear.

  2. Grant write permissions on the configuration file

    Your Drupal download comes with a default configuration file at drupal/sites/default/default.settings.php which needs to be prepared so that the installer can edit it.

    • Copy the default.settings.php to settings.php. You can do this from the command line using cp default.settings.php settings.php.
      NOTE: Do not simply rename the file. The Drupal installer will need both files.
    • You should now have both a default.settings.php and settings.php file in your drupal/sites/default directory.
    • Make the settings file writeable, so that the installer can edit it
      chmod a+w sites/default/settings.php
      or
      chmod 666 sites/default/settings.php
      Both commands have the same effect.
      Several FTP tools like Filezilla, Transmit, and Fetch allow you to change file permissions, using a 'file attribute' or 'get info' command. In this case the octal or numeric value file permission should be set to 666.
    • Drupal should set the file permissions back to read-only once the installation is done. You should make sure this is the case and manually change it yourself if it didn't happen. You can use the same command, slightly modified, to remove write permission:
      chmod a-w sites/default/settings.php
      or
      chmod 555 sites/default/settings.php.
      If you are using a FTP tool the permission should be set to 555.
  • Windows note
    On a Windows system this would be Change permission and make sure the file is not marked Read Only before running the installer and then set it back to Read Only after. For more information about modifying Windows file permissions, see the Troubleshooting FAQ

  • Create database

    • Create database with MySQL

      This step is only necessary if you don't already have a database set-up
      (e.g. By your host). In the following examples, 'username' is an example MySQL user which has the CREATE and GRANT privileges. Use the appropriate user name for your system.

      First, you must create a new database for your Drupal site here, 'databasename' is the name of the new database):

      mysqladmin -u username -p create databasename

      Next you must login and set the access database rights:

      mysql -u username -p

      You will be asked for the 'username' database password. At the MySQL prompt, enter following command:

      GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password';

      where

      'databasename' is the name of your database
      'username@localhost' is the username of your MySQL account
      'password' is the password required for that username
    • FLUSH PRIVILEGES;

      the database should be created with UTF-8 (Unicode) encoding

  • Run The Installation Script
    • To run the install script point your browser to the base URL of your website.

      The base URL is defined in your Web server configuration file and is specific to the document root where you placed your Drupal files. If you have installed Drupal on your desktop machine this URL might be http://localhost.

      You will be guided through several screens to set up the database, create tables,

      add the first user account and provide basic web site settings.