[wp-hackers] Re: [wp-svn] [2744] trunk/wp-settings.php: Fixes
#1488
Nikolay Bachiyski
nbachiyski at developer.bg
Wed Aug 3 11:47:58 GMT 2005
Nikolay Bachiyski wrote:
> Robert Deaton wrote:
>
>> Reading around, PHP_SELF is set on all platforms but does not contain
>> the same information, specifically in regular cgi mode vs php-cgi
>> mode. If anybody has time to test various server setups to confirm.
>
>
> Hmm, Robert is right. For example under mod_php the request to
> http://host/test.php/baba
> results in
> PHP_SELF=/test.php/baba
>
> My initial suggestions is to use SCRIPT_NAME if php is not run as cgi.
> If php is running as cgi we can quite safely (can we really?) disregard
> everything after the extension of the script name in PHP_SELF.
Update: when php is run as cgi (php_sapi_name(): "cgi-fcgi" (fast cgi))
requests with a slash after script's name result in an "No input file
specified." error (apache 1.3, debian, cgi-fcgi).
>
> However, some further tests on different servers/sapi's will be really
> useful. If anybody is willing to test, we shall need the following four
> items:
> - request uri
> - output of php_sapi_name()
> - value of $_SERVER['SCRIPT_NAME']
> - value of $_SERVER['PHP_SELF']
>
> Nikolay.
>
>>
>> On 8/3/05, Nikolay Bachiyski <nbachiyski at developer.bg> wrote:
>>
>>> m at wordpress.org wrote:
>>>
>>>> // Fix for IIS, which doesn't set REQUEST_URI
>>>> -if (! isset($_SERVER['REQUEST_URI'])) {
>>>> - $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
>>>> +if ( empty( $_SERVER['REQUEST_URI'] ) ) {
>>>> + $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does
>>>> this work under CGI?
>>>
>>>
>>> It does not (or at least - not always). When php scripts are run in cgi
>>> environment (I have tested on Apache only) the SCRIPT_NAME variable is
>>> set to "/cgi-bin/php4-wrapper" or something equally unusable for our
>>> purposes. However the PHP_SELF variable always gives us the relative
>>> path to the current script.
>>>
>>> Nikolay.
>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
>>
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list