tags:

views:

35

answers:

2

I've just discovered a setting on the server I'm developing a site for that is different from my localhost settings, however, I can't track down where to change it.

Here's a simple example of what's happening.

$_SESSION['Animal'] = "Dog";
echo "#1: ".$_SESSION['Animal']."<br/>";
echo "#2: ".$Animal;

On my localhost, the server returns:

#1: Dog
#2:

On the public host, the server returns:

#1: Dog
#2: Dog

I'm guessing this is a setting in the public servers php.ini file, however, I cannot locate which setting it is.

+8  A: 

The Registered Globals directive appears to be on.

This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

Information about the register_globals ini setting

As indicated by the statement above, it is highly recommended that you disable this in your php.ini file on your public server.

If you don't have access to the php.ini file on your public server, the manual suggests an alternative:

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 .

Mike B
I could have sworn I had turned them off previously, but obviously not, thanks!
ticallian
+2  A: 

OH NO! Your host has register_globals turned on, that's bad - have a look at these docs

meouw