I posted this in Post Install ( http://drupal.org/node/209950 ), but no one replied, so I'll try here since it has to do with upgrading to 5.6
~

How exactly do I turn off Register_Globals?

Do I just put the PHP.ini in my domain's public_html with it set to 'off'?

That's a local "turn off" isn't it? Where do I get the php.ini to begin with in order to change Register_Globals to "off"?

Can I do a global 'turn off"? Does a global "turn off" affect the whole server, or just my reseller sub-accounts?

If I turn it off for other non-Drupal sites will I run into problems? Like Wordpress for example?

thanks
Quint

Comments

I was actually dealing with the same problem with a test site myself today.

From what I can tell, it depends on what host you're on. We're on a dedicated 1and1 server, and the .htaccess didn't affect the register global variable.

What I ended up doing was placing a php.ini file in the root folder with the following code

register_globals = off

Hope this helps...

Could this be set somehow in the settings.php file?? Just wondering

txcrew

--------
http://3to1studios.com

copied from the php documentation:

"Please note that register_globals cannot be set at runtime (ini_set()). Although, you can use .htaccess if your host allows it as described above. An example .htaccess entry: php_flag register_globals off ."
- http://us2.php.net/manual/en/ini.core.php

creating a php.ini file should work for this, though

Thank you thank you and Thank you itsfridaymoanin!!!

finally resolved for me.

I recently upgraded my drupal site to Drupal 5.6. I am getting a warning in my admin panel to turn off register_globals.
I added a file called phpinfo.php to verify that register_globals was turned on. It is indeed. So I am going to figure out how to turn off.

I contacted Network Solutions asking them to turn off in my php configuration. Their Tech Support assigned me a case # 3 days letter I received a response telling me they would not turn it off because I am on a shared hosting package and it would affect other packages.

Here is an excerpt from that letter:

"Please be advised that the configuration for the register_globals can only be configured on the server side. However, Network Solutions Web hosting packages uses "shared hosting" services. As a result, we cannot modify settings on the servers because it will affect other Web hosting packages on that specific server. We apologize but we cannot configure those settings for you."

A couple weeks ago they also would not help me set up a crontab for some rss feeds I have on my site.

I will find work arounds for both the register_globals issue and for my cron.php but if anyone is setting up a drupal 5 or 6 site I would suggest NOT using Network Solutions. They are not Drupal friendly from experience. I am not advocating any other web hosting companies so I won't say their names here, but learn from my mistakes, and research your web hosting company first as to avoid all these headaches.

Finally figured it out for Network Solutions:

1. Open the File Manager application on the NS site. It's under Web Hosting >> Toolbox
2. Navigate to root: /cgi-bin
3. Create the php.ini file that everyone else has already described right there. Change the editor to text from HTML.

Hope that helps.

Doug

Doug

Thanks Much. This worked perfectly on Network Solutions!

-Hank

thank you, thank you, thank you! I spent hours searching on a solution to this same problem and I have NetworkSolutions too....looks like when I renew I will say "see ya!" this has really sucked to install because of them.

Oh, thank you so much!!!

I spent a whole day looking for this.
Thanks! ^__^

Perfect solution. Fixed me up immediately.

Thanks a ton for this information! Network Solutions has been a pain but luckily we have helpful people like you to help get past these unnecessary hurdles.

Again, thank you!

Like a charm! Thanks a bunch

I thought I was going crazy!
I tried every which way with that rotten php.ini file in the root directory.

Thanks for stating what every one else has overlooked.

I hate being a noob @#$^

Mick
http://guitar-fix.com soon to convert to Drupal.
Working on http://safeworksites.com

P.S. don't forget to open 'advanced options' and change 'ALL' settings to suit your installation..

http://www.DigitalFloods.com

Thanks, That was useful solved my problem ..

Hi
you can write a single file with the name php.ini in the root directory of your hosting account.
In that file write this:
register_globals = Off

This file only affect the account where you put the file.
If you have a hosting service in hostgator (my case) you can do this, change for php5 (register globlas is off in default), add this in the .htaccess file in public_html
AddHandler application/x-httpd-php5 .php

Cheers
webnucleo: http://webnucleo.com
elojas: http://elojas.com.pt

Hello,
I have hostgator as well. I put "AddHandler application/x-httpd-php5 .php" into my .htaccess file and all worked as charm...
Thans for good advice...:)

I too am using Hostgator and would add that code to my .htaccess file to upgrade my site to php5, but alas, one of my modules is not ready yet: http://drupal.org/node/172999

I've burned up a whole day on this. I've restored the DB and fileset like 3 times now, but I think I've found the culprit. If you just use a one-liner with "register_globals = Off", some of the other PHP variables change.

You can see the differences If you do a phpinfo().

Upload a file called phpinfo.php to your site with the following contents.

<?php
phpinfo
();
?>

and run it with your browser.

The problem was that my site was crashing with the following errors

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 11520 bytes) in /home/mysite/public_html/sites/all/modules/trackback/trackback.module on line 769
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 557 bytes) in /home/mysite/public_html/includes/database.inc on line 153
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 135 bytes) in /home/mysite/public_html/includes/form.inc on line 671
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 50 bytes) in /home/mysite/public_html/includes/form.inc on line 1346
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in /home/mysite/public_html/sites/all/modules/views/views.module on line 954
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in /home/mysite/public_html/sites/all/modules/views/views.module on line 954

By running phpinfo I found that the php variable "memory_limit" was going from 40M to 8M with the simple one-liner PHP.ini. I asked my host for a copy of the file and they were kind enough to send it to me (Hostgator is great!).

If you can't get a copy of your main PHP.ini, you can just run PHPINFO before and after adding the basic one-liner PHP.ini and manually add the variables and values that have changed. I found around 10 variables that changed. I also found that it matters in which directory you place and run the PHPINFO file. Put it in the same place as your PHP.ini, which should be in your Drupal root.

I still have a lot of clean-up and testing but I think it's all fixed now.

My host is ipower. I created a php.ini file with the following lines:

register_globals = Off
memory_limit = 120M

This shut off register_globals and fixed my memory errors.

You may not need 120. Drupal core seems to run on about 9. Contrib modules will take more though. I have a few sites set at 24 and a couple at 30, and no problems. I don't have a lot of contrib modules though.

I used lcfranson's way and fixed it.
Many thanks to lcfranson!!!
{My host is ipower. I created a php.ini file with the following lines:

register_globals = Off
memory_limit = 120M

This shut off register_globals and fixed my memory errors.
}

This solution worked for me, hosted on godaddy

I just wanted to say thanks, Quint. I'm also on NetworkSolutions (not my choice!) and your instructions probably saved me several hours of work.

I am using hostgator. Thanks

I too have HostGator and added the "AddHandler application/x-httpd-php5 .php" code to the first line of .htaccess

FIXED!

-
I do not see things the way they are - I see them the way I am

Hi,

I installed drupal on a sub-domain hosted on Hostgator. However, adding AddHandler application/x-httpd-php5 .php to .htaccess file did not work.

Placing the php.ini file with register_globals = off to the php.ini file in the root directory, rather than the cgi-bin directory, works fine.

Thanx.

I was working on this for hours... I just got 1and1 and was about to give up and get a refund until you enlightened me. :) excellent work my friend. (This does NOT work with JustHost (adding a php.ini))

I added "AddHandler application/x-httpd-php5 .php" to the bottom of the .htaccess file in the root folder of the Drupal installation. (I don't placing the php.ini file in the root directory of the hosting account works unless that also happens to be the root folder for the problematic Drupal installation.)

I also used the php.ini file with "register_globals = Off" in it, but I got the PDO error.

After talking to a support guy, he added a new php.ini and now it works.

Worked for me! thanks a million!

Hey there,
Just my two pennies on this. I'm trying to go through the same issue on a 1and1 dedicated server right now, scratching my head over httpd.conf and other files.

If I hadn't already been using drupal for quite some time on a number of sites, I'd just give up and choose something that had proper installation instructions instead. Requiring something that isn't well documented and is very technical to be done in order to get the site even beginning to function is a total dealbreaker.

OK, for 1and1, the best solution I can find is to copy the php.ini file from /./usr/local/lib/php.ini to the root folder of your website, then edit it to read register_globals = off using the vi or nano editors. This preserves the rest of the settings.

On 1and1 I get this error after inserting the php.ini file into my domain's root:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 9 bytes) in /homepages/36/d227944913/htdocs/includes/menu.inc on line 211
Do you know what else I should put in the file other than register_globals = off ?
I do not have access to "/./usr/local/lib/php.ini"

look at my instructions above

you have to bump up the memory

from the documentation on shared hosting on 1and1---

You are here: Overview > Technical Questions > CGI, PHP, SSH, ASP

fix:

Add the following line to the existing .htaccess file in the Drupal root directory:

AddType x-mapp-php5 .php

hope it works for you :)

"AddType x-mapp-php5 .php"
That did it, thanks!
BTW, is this ok even though I am using php4? I have no idea what that did.

From the help files I gathered that the hosting is set to default to PHP4. I believe that the directive makes Apache use PHP5 in which "Register_Globals" is "off" by default. This is confirmed by "phpinfo()". I guess that the only issue would be if your scripts required PHP4.

Thanks for reading the 1and1 docs for us! :)

The AddType x-mapp-php5 .php line in .htaccess was the perfect solution for me.

I just installed Drupal 6 on a 1and1.com shared host.

In the end, I just did what the first comment said: I created a file called php.ini and added 1 line: register_globals = off

Worked great, only gave me memory warning which I expected on 1and1.com

I just installed Drupal 6 on my website.

I got an error message: 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. (Currently using PHP register globals Enabled ('1'))

I cicked on the link for instructions for how to change configuration settings. The instruction was way over my head as I know absolutely nothing about PHP. I tried my best to follow the instructions posted in this forum and here is what I did:

I used TextWrangler (because I am mac user and all files beginning with period are invisible) to open .htaccess and added "AddHandler application/x-httpd-php5 .php" on the fourth line of .htaccess and saved it in the drupal folder on the server. Tested and failed. I opened php.ini in my root folder and added "register_globals = Off" on the second line (the first line had "rg_emulation=off") and saved it on the server as well. I got the same error message.

Did I misunderstand anything? Anything else I should do?

run PHPinfo (instructions above) and see it it says register_globals is 'on' or 'off'. There was some discussion of some Drupal 5 not properly detecting if RegGlob was 'on' or 'off', and I don't recall if 6 had the same problem. PHPinfo will also let you know if you need to bump up your memory.

I cicked on the link for instructions for how to change configuration settings. The instruction was way over my head as I know absolutely nothing about PHP. I tried my best to follow the instructions posted in this forum and here is what I did:

I used TextWrangler (because I am mac user and all files beginning with period are invisible) to open .htaccess and added "AddHandler application/x-httpd-php5 .php" on the fourth line of .htaccess and saved it in the drupal folder on the server. Tested and failed. I opened php.ini in my root folder and added "register_globals = Off" on the second line (the first line had "rg_emulation=off") and saved it on the server as well. I got the same error message.

Per Quint's instruction, I ran PHPinfo and it says register_globals is on. There is no memory issue that I could find in phpinfo.php but just in case, I added:

register_globals = Off
memory_limit = 120M

in php.ini and uploaded the file to drupal's root folder. Tested and failed.

I uploaded php.ini to the root folder of my server. Tested and failed.

I received the same error message about register_globals being enabled.

What else should I do?

If you run PHPinfo now, does it say Register_Globals is 'off'.

It is still on. I am baffled because I thought I have done everything to get it turned off. I'd be glad to give you the link to phpinfo.php if it is not going to be a security risk.

What is a root folder? I realize that it might not mean what I thought it means because when I used TextWrangler to upload files, I saw two folders that I did not see in the FTP software called . and ..

Are one of them the root folder?

I contacted GoDaddy -my server and I was told that I should be able to upload php.ini and it will not affect others. So, it is NOT a server issue. What else?

It has been 3 days and I still have not been able to use Drupal just because I could not turn off the register_globals. Should I give up?

"Drupal root" means the highest Drupal folder. It would be example.com/drupal/ if that's where you installed Drupal, or it could be the Domain root if you installed it there: just example.com.

I put php.ini in the Drupal Root and it fixed the register_globals warning. Also, PHPinfo gives info for the folder it is in. It changes for different folders it's in, You can try putting them both in the Drupal root and see if that works. If not, put them both in the Domain root and try that.

After you get the warning in Drupal to go away, you can delete the PHPinfo file.

I feel your frustration. I'm just a user like you who has tried endless combinations of things. We're all volunteers here, just trying to share our experiences while putting out our own fires.

I put php.ini in the Drupal's root folder that says,

register_globals = Off
memory_limit = 120M

and .htaccess in Drupal's root folder that says,

RewriteEngine on
RewriteCond $1 ^(sandbox|site|submit|features|search|clubs|downloads|events|results|content|forums|article|event_info|discuss|about|archives|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
AddHandler application/x-httpd-php5 .php

And register_globals is still on according to phpinfo.php that is placed in Drupal folder.

Is this the dead end?

I would try it with the default .htaccess.

Dead end? Well, it's always fixable, it's just a matter of how long you want to bang on it.

Backup your custom htaccess and try sticking the distro version in instead.

What host are you on?

Is PHPinfo showing 120 for the memory, or is it ignoring that too?

I asked a friend of mine about this issue and he thinks that the problem has to do with my server (GoDaddy) since the PHP was 4.1 not 5.0. I contacted GoDaddy for support and learned that I had to update my hosting configuration from 1.0 to 2.0 before I could update the PHP. So I did... then I was able to update the PHP. Drupal FINALLY got past the register_globals issue! Yay!

"AddType x-mapp-php5 .php"
Worked for me too, thanks!

Stavos

Reading through some of this I noticed some bad code. Its not; register globals = off , Its register_globals = off

Does anyone know how to disable register_globals if your site is being hosted by Geocities? I've read as much as I can and I've tried all the work arounds suggested here but still no luck. Help, please.

I've just spent a while on this problem (admittedly with a different host - hostgator, who emailed me the php.ini file in the end which worked fine.

One problem I'd had is that the file name php.ini must be in lower case, not capitals for it to work. Thought I'd mention it in case any one else is having the same problem I was.

Website design, website promotion and SEO

Thank you for pointing out this problem, I had it right but it wasn't working, my problem, I didn't have a return between the two lines of code (I didn't know that)

This, DID NOT work for me

register_globals = Off
memory_limit = 128M

--------------------------------------

This, WORKED for me,

register_globals = Off

memory_limit = 128M

if you had not mentioned that, I wouldn't have got it.

Thank you

I have added the php.ini file and AddType x-mapp-php5

I still get the error even though phpinfo.php and phpinfo.php5 show that register_globals is off

I am also on 1and 1 shared so any more ideas are appreciated.

Here's what the message reads now:

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. (Currently using PHP register globals Enabled (''off''))

EDIT: I'm now up and running. Thanks!!

MAAAN!!!!
this comunity is amazing!

I'm off to make some fat ass donations! ;)

--
open your mind with open source
express yourself
own your tools

open your mind open the source
express yourself, share your tools

I think I know why it comes up when it is suppose to be off...

The only place it is "on" - set to 1 - is in the bootstrap in the includes folder around line 220.

The real question is... Do I dare turn it off by editing it... Hrrrmmm

Go to file

modules/system/system.install

line 10 and under of line that say

$register_globals = trim(ini_get('register_globals'));

put it

$register_globals = 'off';

See

http://api.drupal.org/api/function/system_requirements/5

Regards,

WTF? You realize that is only messing with the detection of the server status and lying to itself in order to ignore a warning? It's not fixing any problem.

I don't think register globals is a fatal error that will prevent Drupal working, it's just a security notification, so it's possible to just live with it. Disabling out the warning like that however is a bit wrong. But I guess I can see why you'd want to.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

I added a handbook page a few days ago with an alternate solution that might be of use to some who are stuck. http://drupal.org/node/290592

Dear asanchez75

I JUST LOVE YOU! I DID IT, AT 5 AM IN THE MORNING, AFTER 2 HOURS! ;)

From dman just below the "solution":

You realize that is only messing with the detection of the server status and lying to itself in order to ignore a warning? It's not fixing any problem.

It all sounds so simple, but how do I create the php.ini file? Do I try to find another .ini file and use that? I can't find any .ini files.

Do I edit an existing .php or .txt file?

How do I create the php.ini file in the first place?

By the way, I ran a file to find my php.ini file by adding a .phpinfo file to my root and going to that URL.

It says the php.ini file is here: /etc/php.ini But I don't have any etc folder in my drupal files...

Thanks.

I didn't run into this error until I set up Drupal 6 in a development environment on my Linux machine.

Though I imagine most people doing this will know how to fix it, there may be a few who look for help.

The php.ini file for LAMPP is found in:
/opt/lampp/etc/php.ini

-----------------
Josh Stevens
Electric Transcendentalism

-----------------
Josh Stevens
Cartography & Geovisualation

I'm trying to set up Drupal on Doteasy and having this problem (on Ultra hosting). I have tried php.ini in just about every folder I can access (some folders won't let me add a file), php.ini within /etc doesn't have an edit option. Also tried the htaccess ideas within the Drupal folder (although I'm not positive that I got the syntax right).

Thoughts?

Shrill

I installed 6.10 on a Doteasy subdomain. I couldn't get the .htaccess or the php.ini to stick. Contact support and they will disable register_globals. I don't know why they have it on by default, or why they are the only ones with the keys, but that's the way it is.

------------------
website | livejournal

just saying .htaccess is best solution for 1and1.

another thing to look out for is to make sure you go to advanced when installing the Database make sure its 5.0 and you change database host to db*****.perfora.net (insert your address) because it's not local on 1and1. this setting is under advanced when installing drupal on step 3

i've tried all of this and non is working and even though i tried to change the .htaccess in the main log folder of the hosting package because i reserved a developer hosting package on 1and1 and i couldn't and i've created .htaccess file and put it in my root directory of my website and didn't work with the AddType x-mapp-php5 .php and have put the php.ini with the register_globals = off and nothing work and put them together noting also works so what is the solution because 1and1 technical team doesn't help and they play games but i know they understand what i'm talking about

thanks and help is really appreciated

Mohammed

Thanks for the help everyone. I found that the easiest way to accomplish it at hostgator was to log into cpanel, click on "php.ini Quick Config" and turn off Register_Globals - you don't even have to ftp in or modify any code. Hope this helps.

Thank you terickson! I use Hostgator...your solution fixed the problem and was extremely easy. I read all the posts and was beginning to get a headache....so thank you so much for posting your solution!!!

Update = I just created another Drupal site (this is about a year later) on another Hostgator account and terickson's solution worked just great...again. Thanks for the tip terickson!

Hello and thanks a lot for this quick and easy solution. I am on hostgator too and when trying to install drupal 7.7 it would not proceed with the installation unless the php register globals was off. After messing around i turned it off by the cpanel PHP ini EZ config.

Works like a charm

Cheers

Elvin Xhimitiku
Drupal in Albania

Elvin Xhimitiku

Drupal in Albania!

I'm with hostgator too. From my cpanel I could turn off Register_Globals. just go the your cpanel, open the icon for Php.ini quick config, then enable quickconfig. Scroll down the several options and select the radio button for Register_Globals off. Go down the window and click on the Save button to save your changes. Keep quickconfig enabled, and Register_Globals will be off for all the domains related to your account (primary domain and the other you have added).

Thank you mate. Your contributions here saved me hours of hard and unfruitful guess work. Had I not stumbled to this forum through google search I would have still be battling with how to turn the register_global off. It worked for me. Thanks a million.

inetguru

The info really saved me a lot of time and effort! I'm working with Network Solutions, and the fix worked like a charm.

Hello drupal community!
I have some problem with register globals in my server.
When i'm try add to my .htaccess file line - register_globals = off i'm take mistake - Internal Server Error 500 :(
I'm drop to my root directory php.ini file, but it's still doesn't work for me.

I have the same problem. Help please.

For those of you who have no idea how to create the php.ini file, please consider the following. I have a hosted account with 1and1 and I am also a novice at this stuff. All I did was create a text document in Notepad on my computer and called it php.ini. Please note that by default, my computer saved it as a text document (php.ini.txt). I then opened it and added the following to the document:

register_globals = Off
memory_limit = 120M

After that, I uploaded it to the same folder on my server that my drupal is in (open the drupal folder and upload the file there). I tried again and found the same error. After racking my brain for hours, I decided to try changing the file name from "php.ini.txt" to just "php.ini". WORKED LIKE A CHARM!

I don't mean to be rude but I think there's enough post saying "thanks, it worked"

I'm on shared hosting ELSERVER.com and php.ini and/or .htacess approaches made register globals off. Does anyone know other workarounds?

Hey,

So I tried everything, but what worked for me on PHPWebHosting.com was to simply create a .htaccess file with the following code

php_flag register_globals off

Nothing else worked

Hi,

I just installed Drupal 6.14 on Network Solutions server for my work. I had the same issue and searched around for exactly what to do. Here's what I did.

1. I created a file in notepad named php.ini and filled it in with this single line and nothing else:
register_globals = off

2. I went into my network solutions file manager and continued to click Parent Directory until I saw a folder named /cgi-bin and uploaded my new file there.

3. I logged out of my drupal site and logged back in and viola! Problem solved.

I've got drupal set up in a test folder right now as our company's site was originally written on WordPress and they wish to update it. Our Wordpress site runs very, very slow and I am now concerned that a Drupal site might be as slow due to how Network Solutions deals with sites built around MySQL databases (of which pretty much all OSS CMS use, right?). It seems to be that that is what others have had difficulty with. Any guidance?

We have a sister-site that is served on a larger windows server by ns and it seems to run really well, but they paid buckets of money for it to be written compared to the WordPress site, which cost 1/100 of that amount.

create a new .htaccess file (never mind that your drupal folder already has one) and dump it anywhere on your hosting.

Place in that .htaccess file one line only:

SetEnv REGISTER_GLOBALS 0

it should help.

If you are using NS to host your DRUPAL Site, go to your cgi-bin pathway then, to the .php pathway. In this pathway is a file, php.coalesced.ini. Inside this file is the variable register_globals, set to "On" change this to Off. This will correct the error.

Go to your cpanel >> php.ini EZConfig >> turn off Register_Globals

no need for php.ini or httaccess edit

We had the same issue recently with a client's shared hosting installation of Drupal 7.

The .htaccess configuration was ok.

The issue was with the host where register global was on.

Some share hosting providers include the ability to turn this flag off via their supplied control panel. You just need to ask them where the settings reside. Alternatively the hosting provider can turn it off.

Or you can create a php file as some of the users have suggested to override the setting.

Al

--------------------------
Build with passion...

www.fortrust.co.uk

By default register global is set off by the way.

Al

--------------------------
Build with passion...

www.fortrust.co.uk

Just wanted to follow up on all of this, I am have two sites having this issue and I'm on hostgator and they managed to do the whole thing over the live chat for me in about 2 minutes - super helpful!

I just did this on a Network Solutions account to get it working for Drupal 7.

php.ini (in cgi-bin directory above web root)

register_globals = off;
upload_max_filesize = 20M;
post_max_size = 96M;

Not all chemicals are bad, H20 for instance is a vital ingredient in beer.

The following solution worked for me. It will also work in case of joomla or moodle errors also.

http://techieguysonline.com/2013/05/22/modifying-register_globals/