RE: differences in between these env. variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Tedd Sperling [mailto:tedd.sperling@xxxxxxxxx]
> Sent: Friday, January 27, 2012 12:09 PM
> To: php-general. List
> Subject: Re:  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@xxxxxxxxxxxx
> 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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux