[thelist] Trouble with PHP Include

Dejan Kozina dejan at kozina.com
Tue Feb 18 10:00:40 CST 2014

You can - and definitely should - set register_globals to off. This is a
legacy setting that host providers sometimes keep enabled in order to
avoid breaking (very) old PHP scripts. register_globals has been removed
altogether from PHP 5.4, so any script relying on this behavior will
stop working when your host upgrades to 5.4.

There are two ways to set register_globals to off (and set many more
settings): in a .htaccess file when PHP is installed as an Apache
module, or in a php.ini file when PHP is called by Apache as an external
CGI or FastCGI binary. To find out which is your case make a PHP file
with phpinfo() in it and call this file from the web. Look in the
resulting info page for the 'Server API' value: if it says 'Apache 2.0
Handler' PHP is installed as a module and you should put the line
'php_flag register_globals off' into the .htaccess file in the root
folder of your site (subfolders will inherit the value); if it says
something like 'CGI', it's not and you should create a file called
php.ini with the line 'register_globals = Off' in every folder
containing callable PHP scripts (subfolders will not inherit).

Another faster and rougher way to find out how is your PHP set up is to
just go the .htaccess way and see what happens. If the server continues
to deliver your pages and seems generally happy with it you're done and
PHP is a module; if you get a '500 Server error' remove the offending
line and go the php.ini way, 'cause your PHP is a CGI binary. You may
not want to try this shortcut when your site is getting hundreds of
requests per second, I guess... :-)


On 18/02/2014 15:00, patrick wrote:
> On 2/18/2014 8:46 am, Sarah Adams wrote:
> You might also try turning off register_globals in .htaccess -- worth a
> shot. Another option is to add/modify a php.ini in your root html folder
> and add
> |register_globals = off
> |

Dejan Kozina
Dolina 346 (TS) - I-34018 Italy
tel./fax: +39 040 228 436 - cell.: +39 348 7355 225
http://www.kozina.com/  - e-mail: dejan at kozina.com
skype: dejankozina - calendar: http://calendar.kozina.com/

More information about the thelist mailing list