Posted by limay on January 19, 2008 at 10:13pm
I just installed Drupal and am getting the message that register_globals is enabled. My web host saus register_globals is off. I am a real newbie, trying to do this myself and can't understand a lot of info in the forum replies. I do see that you can disable this by modifying that .htaaccess file. EXACTLY, what do I add to this file and where do I add it? Thanks for any and all help.
Comments
=-=
have you run a phpinfo() to insure that your hosts support is correct ?
you can use a custom php.ini file and set register_globals = Off
I don't use the .htaccess method, I prefer hosts who allow custom php.ini files to override default php settings.
Neither method helped so
Neither method helped so far.
http://www.rssmedco.com
www.elols.com - gaming online
www.rssmedco.com - something different
found solution to disable register_globals
FOUND IT !!!
simply add
AddType x-mapp-php5 .php
at the bottom of .htaccess file.
Worked for me.
www.elols.com - gaming online
www.rssmedco.com - something different
How to disable register_globals server side
Hi guys, my phpinfo says that register_globals in enabled in php core... how can I disable that?
-Josh
Geeks For Christ - http://00110111x3.net
=-=
check with your host by filing a support ticket or by reading your hosts knowledge base for the method that your host prefers to have defaults overridden.
Many use a custom php.ini file, which you would have to copy from your server, adjust and add to your root folder.
Already called support
Hehe, well I've filed a support ticket, but havn't heard back. Also, I called support and the girl kept telling me to configure my .htcaccess file (or however it's spelled). Haha, well I kept trying to explain that it's enabled server side. Ok, we'll see.
-Josh
Geeks For Christ - http://00110111x3.net
=-=
.htaccess handles server side directives
custom php.ini
hi there. I would like to ask if i should insert anything in the custom php.ini? or just only certain script?
Where EXACTLY did you put
Where EXACTLY did you put the "AddType x-mapp-php5.php" in the .htaccess file? I'm having the same problem and can't find a way to solve it.
I already asked my host and instructed me to add php.ini in my root folder with 'register_globals = Off'. I did that but when I install Drupal its still says register_globals is 'On'. I checked my phpinfo.php and it says there that its 'Off'.
This is so frustrating!! What should I do? Please help.
Did you find your .htaccess
Did you find your .htaccess file in the root directory?
If so, then open it and add:
AddType x-mapp-php5 .php
at the bottom of .htaccess file. Save and upload back to server.
www.elols.com - gaming online
www.rssmedco.com - something different
A better way...
<FilesMatch .php>SetHandler application/x-httpd-php5
</FilesMatch>
...in your .htaccess
Thanks "custom php.ini file
Thanks "custom php.ini file and set register_globals = Off" worked perfectly for me.
I was starting to stress because I couldn't get the setting in the .htaccess file to work and I tried the php.ini file with register_globals off, just needed to add that little old = sign for things to start working.
Jereme Guenther
php.ini worked!
Thank you guys, the .htaccess method didn't work for me, but creating a file "php.ini" with that value in it did the trick. No one really said to place it in your root directory, but that's where it goes in case anyone doesn't read between the lines.
How exactly is the php.ini file coded?
Hello everyone,
I'm a complete newbie to PHP so I don't know if I'm coding the file correctly. I'm trying to get a drupal site working on xammp and have added a php.ini file to the root folder. The file has this code in and nothing else:
[PHP]register_globals = Off
Is that right? Do I need some other characters or something? Is it different on a localhost?
Thanks for any help,
David
David
custom php.ini DOES WORK.
custom php.ini DOES WORK. Forget about adding anything to .httaccess file. Use only custom php.ini and set globals to off
www.elols.com - gaming online
www.rssmedco.com - something different
tip
hi guys,
Just thought I'd add this solution that worked for me. My symptoms were:
This is what I did...(thanks to Dublin Drupaller for putting me straight on this)
<?php system("cp /usr/local/php5/lib/php.ini /home/YOURUSERNAME/php.ini"); ?>If you are unsure where on the server your default php.ini is, create a php file called phpinfo.php with the following in it
<?php phpinfo(); ?>.Upload it to your root folder and in your browser, go to www.example.com/phpinfo.php. Scroll down a bit and it should indicate the exact path for where your default php.ini is located on the server.
<Files php.ini>order allow,deny
deny from all
</Files>
hope that's of use to others. I was stumped for hours over this.
thank you so much!
I had the same problem as you - I couldn't access the default php.ini file - and I was going nuts because the htaccess fixes didn't work either. But I followed the steps you outlined above, and now the installation works. Super happy day. You rock Philip. :)
..
you're welcome.
the nice thing about this approach is it offers you a lot more control over other php.ini settings...such as max upload size etc. which is very useful.
glad to be of help, by the way but it was dublin drupaller who put me straight on that..
can't find php.ini
Hello,
I am trying to configure the php.ini but I can't find it. I created the phpinfo.php file, which worked fine, and confirmed that register_globals is enabled and that the php.ini in the usr/lib directory. But, when I FTP to the server, I can't find that directory anywhere. What am I missing?
...
<?phpsystem("cp /usr/local/php5/lib/php.ini /home/YOURUSERNAME/php.ini");
?>
If you are unsure where on the server your default php.ini is, create a php file called phpinfo.php with the following in it
<?phpphpinfo();
?>
Now, when you go to the root folder of your site, using FTP, you will see a new php.ini file. That's a copy of the default php.ini. Open it in a text editor like PS PAD, search for the string register_globals and set it to off.
yeah, I followed the
yeah, I followed the directions in step 2, and the phpinfo.php page says the php.ini is in a /usr/lib directory. But that directory cannot be found on my server. Is it possible that it is hidden or something?
..
yep. that's the whole point of a gettheini.php (see step 1 again). If you could see your /user/lib folder using ftp you wouldn't need gettheini.php.
Ah ok, I got it, thanks! BUT...
The copy of the php.ini says that the register_globals is already set to "off", despite the phpinfo saying that it is on...
UPDATE
I added the line,
<IfModule mod_php4.c>php_flag register_globals Off
</IfModule>
to my .htaccess file, and the the phpinfo.php now indicates that register_globals is off. But Drupal still thinks it's on. I am just trying to run the install script to finish the install, but am still getting the "Incompatible environment" error.
Thanks for your help!
Works!!!
Thanks, this was the only thing that worked on my sites hosted by IXWebhosting! However, I had to put the modified php.ini file in the cgi-bin folder, and did not need to modify the .htaccess file.
-Alex
Thanks ogiebobo a combination
Thanks ogiebobo a combination of yours and the earlier post have helped a lot. ixwebhosting is the hosting choice of my client and it's really nasty to use. I miss cPanel.
`
phpinfo
Hi all,
I have uploaded phpinfo.php in root directory and here is the configuration
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/php5/lib
Loaded Configuration File /usr/local/php5/lib/php.ini
Scan this dir for additional .ini files (none)
additional .ini files parsed (none
I have contacted support as well they sent me the ini file which doesnt work!,
I am new to PHP but i guess there should be something instead of (none) for custom ini to work,
Please help!
Hi, I have tried all the
Hi,
I have tried all the suggested methods but neither is working .. :
1) My host does allow to upload php.ini file so i did upload one at the drupal (6.14) root with register_globals = off. However this did not solve the problem
Next, I tried updating the .htaccess with the following code : AddType x-mapp-php5 .php. Even that hasn't helped.
Lastly, I tried the custom php.ini method suggested above. After uploading and running the gettheini.php file the php.ini file did not appear at the specified location; neither did i get any error . I have tried all the commands suggested replacing system with exec, shell_exec and passthru . But nothing seems to work.
Any suggestions ?
Bhambry
=-=
If none of the methods work you will have to check with your host. They may not be allowing changing defaults on their servers.
Thanks Phillip
Your concise description on how to get the register_globals defined as Off just simply ROCKS!!!
I did not have to wait for responses from my host. Its just great! You rock!
R Marikhu
Help!!
I followed Phillip's directions but didn't work for me. I guess my problem is where to copy the php.ini. I don't understand what "/home/YOURUSERNAME/php.ini" stays for.
Any help is very appreciated.
Thanks.
=-=
php.ini should go in the root folder of your server, wherever that is. you can also add it to the root of your drupal install.
yes but..
a very stupid question....
I have to type something instead of"home" or keep it as it is?
And USERNAME is the username I use for my FTP connection?
Thanks V..M..
=-=
home and username may not mean anything to you. Not all servers are set up the same way.
you have to upload the php.ini file to your accounts ROOT folder
it could be named public_html , I don't know your servers folder structure, I can't see it. put it where index.php or drupal is (also can be your account root as I don't know where you have drupal installed).
some hosts use /home/username/ some use /username/public_html. there are multiple ways a host can have their folder structure. where useranme is the username you would use to login to your hosting backend, ie: cPanel or whatever. again I don't know how your server is setup. At this point only you (you should) and your host do.
In some cases, php.ini needs to go in a different directory
Just a note on this -- I tried everything mentioned in this thread: php.ini in root directory, in root/cgi-bin, tried .htaccess methods, etc. Everything but the methods involving phpinfo.php outlined above.
As it turns out, I should have done this first. What I found when I uploaded phpinfo.php and navigated to it was that, in addition to showing me where my host has the default php.ini file, it also showed me where he'd set PHP to scan for additional .ini files. It wasn't in the root directory, but (in my case) in a subfolder called _custom_php_settings.
If you're just now getting the warning about register_globals being on, trust me -- upload a phpinfo.php file FIRST, and save yourself a lot of frustration.
(Other than the directory location, my experience has verified everything else in this thread regarding php.ini. Thanks all!)
need help
not able to disable register_globals
wat to do...i tried alot.....pls help