Working with Register_Globals OFF

How to use old scripts when your webserver's REGISTER_GLOBALS setting is OFF

With the release of PHP v.4.2.1, REGISTER_GLOBALS setting is set to OFF by default. This means a lot of old (legacy) PHP scripts that used to work flawlessly on your webserver suddenly throws up errors and warnings all over the place at best or simply stops working altogether.

I had a couple of these scripts installed on my website and it looked like the updates from the script developers were not happening fast enough, so I did the next best thing:

Set REGISTER_GLOBALS ON per script / web folder

Let's assume you are using an older version of PHPADSNEW which does not support REGISTER_GLOBALS OFF settings. The path to this script on my web server was:
path: /home/jds/public_html/phpadsnew

Solution using a .htaccess file

I created a .htaccess file and uploaded it to:
path: /home/jds/public_html/phpadsnew/.htaccess

inside this .htaccess file I typed:

code:
php_flag register_globals on

This only works if you're using PHP as an Apache module and you'll need AllowOverride Options or AllowOverride All privileges on it.

Once you have completed uploading this file to the phpadsnew folder, everything should work like before! This is actually an Apache directive so, if you're using anything but the Apache Web Server, you're on your own, buddy ;)

n.b. The latest version of PHPADSNEW already supports REGISTER_GLOBALS OFF settings.

TOP

Do you find it easy to navigate through this site?

 Yes

 No

 Where am I?