RE: [PHP] differences in between these env. variables
| From: | admin at buskirkgraphics dot com | Date: | Fri, 27 Jan 2012 17:17:12 +0000 |
| Subject: | RE: [PHP] differences in between these env. variables | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316415@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Tedd Sperling [mailto:tedd.sperling@gmail.com]
> Sent: Friday, January 27, 2012 12:09 PM
> To: php-general. List
> Subject: Re: [PHP] differences in between these env. variables
>
> On Jan 11, 2012, at 9:24 PM, tamouse mailing lists wrote:
>
> > Is there ever a case where SCRIPT_NAME does not equal PHP_SELF?
>
> Was this every answered? I would like to know.
>
> Cheers,
>
> tedd
>
>
> _____________________
> tedd@sperling.com
> http://sperling.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Ted I show on the 11 Jan there was 2 answers.
I'll extend your example. We now have a RewriteRule in apache like this:
RewriteRule ^files/?$ /directory/file.php [L,QSA]
Which will rewrite /files/... --> /directory/file.php
REQUEST_URI now contains how it was called by the browser,
'/files/something.php'
SCRIPT_NAME returns path to script (/directory/file.php), set by the SAPI
(apache, ..).
PHP_SELF returns also the path to script (/directory/file.php), but set by
PHP self.
I don't have any ORIG_PATH_INFO on my Ubuntu box, so be careful about this
one.
Recommended: Depends on which you need. I prefer PHP_SELF over SCRIPT_NAME,
but that's more personal choice.
Matijn