Re: $PHP_SELF not set !

From: Date: Tue, 27 Nov 2001 22:40:10 +0000
Subject: Re: $PHP_SELF not set !
References: 1 2  Groups: php.qa 
Request: Send a blank email to php-qa+get-4076@lists.php.net to get a copy of this message
> >Richard; > > > >I run a production server with Apache/Win32 with PHP 4.0.6 as an > >Apache module. > > > >$PHP_SELF is used all over the place in my scripts, without a > >problem. I rarely reference a page's name directly, I almost always > >call $PHP_SELF instead. > > To be more clear: By "mysterious unknown circumstances" I meant that > sometimes it works, sometimes it doesn't. Nobody has ever correctly > diagnosed the conditions under which $PHP_SELF does/doesn't work. > It's easier to dig through phpinfo() and find the value in some other > variable than to actually fix the problem. OK its quite simple under any sapi other than CGI it should be set all the time (not verified). Under CGI it is ONLY set if SG(request_info).request_uri is set which itself gets its value from PATH_INFO env varaible and if that isnt set the SCRIPT_NAME varaible. If SCRIPT_NAME or PATH_INFO are not in the environment then PHP_SELF is not set. - James

« previous php.qa (#4076) next »