Story for background problem: I have a hostgator account. Uploaded the content of a drupal install folder to the actual root of the server. To fix this, I deleted all the files that I recognised from the drupal installation folder. The hostgator person on the chat reassured me that by default the .htaccess file is empty so going to back to an empty would bring me back to the original state. Everything seemed fine

Until I wanted to update 1 drupal 7 installation from 7.17 to 7.18. when starting to run mysite.com/update.php it said

  PHP register globals  Enabled ('1')
register_globals is enabled. Drupal requires this configuration directive to be disabled. Your site may not be secure when register_globals is enabled. The PHP manual has instructions for how to change configuration settings.

Checked the cpanel's php quickconfig settings. This said register_globals was set to off. So that means this setting is overwritten somewhere on a deeper level (it's a shared server so the root of my server is at a deeper level than the php installation which I obviously can't touch). There IS a php.ini file in my root folder of my server but that one also says

register_globals = Off

I looked up this problem and a lot of people seem to solve this by settings the register_globals to off in the places I mentioned. I also put a php.ini file in my drupal installation folder at the same level as my index.php file. This solved the register_global problem, but then I started getting errors about the PDO not being compatible with my current php version (5.2.13 while PDO would be needing 5.2.4 and up). And I don't think asking my provider to update php would be the way to go....

  • I had the same issue with a shared hosting provider, and it was simply caused by the .htaccess file provided by Drupal that was overwritten by an empty file. Once I restored the original file, the problem vanished. – kiamlaluno Jan 13 '13 at 17:48
  • I did what you said. Didn't help. I just overwrote the .htaccess file in drupal folder by the .htaccess from a new install folder. Didn't solve the problem. Every php.ini or .htaccess file I've come across so far has register_global set to false. You can't possibly mean that at the root even before /www on the server, you need to overwrite the .htaccess with the htaccess from drupal at that level can you? – Immers Jan 13 '13 at 18:35

I have hostgator account too. In hostgator and certain other host providers the php.ini that overrides the default values should live in /home/USER/ (i.e. check if /home/USER/php.ini exists, where USER is the username of your hosting account). Make sure that this file has register_globals = Off.

If /home/USER/php.ini is not there then either copy the default (if you have shell access check php.ini location with the command php -i | grep php.ini and then copy this file to /home/USER/php.ini) or ask tech support to help.

More details can be found here on HostGator support site.

Finally, if you are using drush on your host account you might encounter "Register globals detection" issue in which case I would suggest the solution in comment #6, i.e.

cd drush/
ln /home/USER/php.ini php.ini

the resason for this is that drush script (drush/drush) checks for drush/php.ini and if it does not find it there it detects the default php.ini not the /home/USER/php.ini one.

|improve this answer|||||

I had this same problem with a CPanel web host recently.

I solved the register_globals and PDO errors with a php.ini file in the drupal root:


register_globals = off
upload_max_filesize = 32M 
post_max_size = 32M 
memory_limit = 256M

After that, all was peachy.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.