Forum Moderators: coopster

Message Too Old, No Replies

PHP 5 and $PHP SELF

         

tim222

9:23 pm on Aug 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I switched over to a new web host that has PHP 5 installed and I noticed quite a few lines in the error log:

PHP Notice: Undefined variable: PHP_SELF

However the script works as intended, and the proper script path is displayed where it's supposed to be.

I don't know if this was an issue on the previous server, since the error logs were not as accessible on that server so I never looked at them.

So does PHP 5 handle PHP_SELF differently than PHP 4?

WesleyC

9:28 pm on Aug 13, 2007 (gmt 0)

10+ Year Member



$PHP_SELF is only present if register_globals is on or you unpacked the $_SERVER variable in your script--neither of which are particularly good ideas.

To access the variable now, just use $_SERVER["PHP_SELF"].