Re: PHP_SELF & SCRIPT_NAME differences

From: Date: Tue, 12 Oct 2004 23:48:22 +0000
Subject: Re: PHP_SELF & SCRIPT_NAME differences
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-199317@lists.php.net to get a copy of this message
* Thus wrote John Holmes: > Jordi Canals wrote: > >I'd like to know the difference by using the $_SERVER['PHP_SELF'] and > >$_SERVER['SCRIPT_NAME'] variables. After I read the manual, I have not > >found the difference betwen the two when used in a Web Script. Also, > >in all tests I've done, I get the same result in both variables. > > PHP_SELF seems to be more reliable as SCRIPT_NAME isn't populated on > some OS, in my experiences. But if both are present, they'll have the > same value. SCRIPT_NAME comes from CGI 1.1 and is required according to the specifications, iirc, it depends on how well the paticular webserver impelments the CGI spec when running php as a module. PHP_SELF will almost always be filled out, it is defined within PHP itself. Curt -- Quoth the Raven, "Nevermore."

« previous php.general (#199317) next »