tags:

views:

81

answers:

4

Hi, my web hosting has the register globals on and I need to turn it off, when using a .htaccess with the following code in the root directory

php_flag register_globals off

I get the following error

Internal Server Error, this is an error with your script, check your error log for more  information.

any ideas please.

A: 

Not sure, but I think you have to put off in quotes:

php_flag register_globals "off"

Could be wrong here though, haven't done this for a long long time ;)

PS: This belongs on serverfault, doesn't it?

PPS: The PHP Documentation says that the default value is "0", including the quotes. Maybe off has been deprecated in recent versions.

x3ro
this doesn't work either.
amir
I still get the same error.any other ideas please
amir
A: 

Try removing the .htaccess file and placing a php.ini file in its place with register_globals = Off in it.

The 500 server error from a .htaccess file points to php being run as a CGI rather than an Apache Module

Nathan
this doesn't seem to turn off the register globals either, is there any other ways, thanks
amir
+3  A: 

most likely your host is not allowing that setting in .htaccess files. If you have a php file that is always included you can turn it off there

ini_set('register_globals', false);
jdswift
In addendum to this, you could put this code in a PHP file and then auto-prepend this to each file: php_value auto_prepend_file "doregisterglobals.php"
mattbasta
+1  A: 

If worse comes to worse and you can not disable it, try this psuedo code

  • Loop through all superglobals
  • If $var = $_SUPERGLOB[$var] then unset()
alex