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.
January 20th, 2008 - 23:40
You have these directives reversed; the “Method 1″ syntax goes in .htaccess, “Method 2″ goes in php.ini.
January 21st, 2008 - 22:36
Thank you Papayoung, you are right, I did mix the two up. I have edited the post.
February 1st, 2008 - 04:48
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…
May 19th, 2008 - 20:01
yay! worked for me, thanks
October 23rd, 2009 - 09:04
Thanks, it’s worked!
January 1st, 2010 - 23:53
FWIW – I had to use method 1 and the content was;
register_globals = 0
January 2nd, 2010 - 19:28
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
January 8th, 2010 - 18:02
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.”
January 18th, 2010 - 10:58
Thanks the php.ini version worked for me too!
February 8th, 2010 - 17:49
some body can paste the code for the php.ini ?
how can I create this doc php.ini ?