NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
session side-effect and global variables


Joined: 29 Jul 2006
Posts: 4
Location: UK
Reply with quote
I am currently using PHP debugger to try to find a problem on some php pages.

When I run it I the page displays:

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0.

Can anyone give any clue what could be wrong with my code?
View user's profileFind all posts by sametchSend private message


Joined: 25 Jul 2006
Posts: 28
Location: Germany
Reply with quote
Hello,

the setting is in your "php.ini" file and looks like this:

register_globals = Off

Depending on your server installation, there *may* exist multiple "php.ini"
files, e.g. in the apache/bin as well as in the php directory (of which the
one in the apache/bin is being used if it exists I think - I'm not an admin *g*).

Above setting may be changed on your server since you have access,
but if you publish your site on a hosted system, you may not be able
to change "register_globals".

Not sure, if/how above setting is allowed to be changed during runtime
(or if it is a security risk if being active), so maybe someone here can
provide more insight into this, otherwise google should do. Wink

Cheers,
Tobias
View user's profileFind all posts by condev1972Send private messageVisit poster's website
Re: session side-effect and global variables


Joined: 25 Jul 2006
Posts: 28
Location: Germany
Reply with quote
sametch wrote:
session.bug_compat_42 or session.bug_compat_warn


Forgot to mention that above settings are also in your php.ini file
and look like this:

session.bug_compat_42 = 1
session.bug_compat_warn = 1

So you might want to set the last one to "0". Smile

Cheers,
Tobias
View user's profileFind all posts by condev1972Send private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
register_globals and session.bug_compat_42 are not recommended settings. Please read php manual on why such recommendations are made.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 29 Jul 2006
Posts: 4
Location: UK
Reply with quote
I guess I am more concerned about what I could do differently in my code. I am assuming my wbe server has register_globals set to off (it uses plesk 7.5).

Could anyone suggest what it is I am doing to cause the error.
View user's profileFind all posts by sametchSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
"Assume" is a good thing but insufficient Smile
Run phpinfo, locate path to php.ini you system uses, correct this php.ini and you'll be all set.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 29 Jul 2006
Posts: 4
Location: UK
Reply with quote
When I have tried to run phpinfo in the past it has not worked (works fine on my local PC with apache/mysql/php). I think the people who manage the server have disabled it and I can't change that. Also if my php code has any error I get no error messages just a blank screen hence why I wanted to try PHP Debugger to find any problems and I can't change that either. Hence my assumption that if they have gone to these lengths, they also have register_globals off.

Because I am new to PHP my main question is how can I code things differently so that it doesn't matter if register_globals is off? ie what is it in my code which is wrong.
View user's profileFind all posts by sametchSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
I miss the point.
In the first post you stated that:
Quote:
When I run it I the page displays:

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0.


now you tell me this:
Quote:
if my php code has any error I get no error messages just a blank screen


Neither of the problems have any relation to Php debugger. Please check with guys who are managing your server.
View user's profileFind all posts by dmitriSend private messageVisit poster's website
session side-effect and global variables
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic