CognitiveCombine.com stylishly packed, cognitively underlined & followed by a strong dose of tomfoolery

18Jan/08Off

Drupal, register_globals and a tip

I recently installed Drupal on my development site. My webhost had register_globals turned on and Drupal requires them to be off. I read through the Drupal user forum and came across two methods to manually override this issue: Updated 2010.01.01

Method 1

Place a file called php.ini in your accounts root directory with the following content: register_globals = false (you can also try using 'off', or '0'instead of 'false').

Method 2

Place a file called .htaccess in your acccounts root directory with the following content: php_flag register_globals off

For me, only the 2nd method worked.

Tip

Finally, if you are using your MySQL table for more than one application, for example a phpBB forum as well as Drupal, then it is a good idea to set a table prefix such as drupal_ since Drupal does not use any prefix by default, which can lead to confusion if you have any other non-prefixed tables.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Tagged as: , , Comments Off
Comments (10) Trackbacks (2)
  1. You have these directives reversed; the “Method 1″ syntax goes in .htaccess, “Method 2″ goes in php.ini.

  2. Thank you Papayoung, you are right, I did mix the two up. I have edited the post.

  3. Hmm. Wish you had linked where you scraped that from the forums; I can’t seem to find it – and going from 6.0 RC2 to RC3, this thing suddenly popped up (where it had not before). Yes, even with ‘false’ and ‘off’.

    Neither of these worked. But sure enough, globals are on… grr. I’ll dive into those forums to see what else was posted. Such a joy…

  4. yay! worked for me, thanks

  5. Thanks, it’s worked!

  6. FWIW – I had to use method 1 and the content was;
    register_globals = 0

  7. It didn’t work for me in Hostgator. I tried this also without luck:

    php_flag register_globals 0
    Finally I went to built-in PHP QuickConfig to disable it
    More info about this issue

    http://drupal.org/node/222343

  8. Thank you David!
    So on HostGator this will work. It surely worked for me.

    “You can try using a custom php.ini file located in Drupal’s root folder (i.e. the folder containing Drupal’s index.php). This will only work if your host has enabled the use of custom php.ini files.

    So, create a file named php.ini in Drupal’s root folder with the following line:
    register_globals = off

    If php.ini already exists then add the above line to it.”

  9. Thanks the php.ini version worked for me too!

  10. some body can paste the code for the php.ini ?
    how can I create this doc php.ini ?