From:             jr-php2 at quo dot to
Operating system: Linux
PHP version:      5.0.5
PHP Bug Type:     CGI related
Bug description:  $_SERVER['PATH_INFO'] always empty when PHP invoked from CGI 
script

Description:
------------
Under PHP 5, when PHP is invoked from a CGI script (using Apache 2.0.54's
standard mod_cgi mechanism), the PATH_INFO environment variable is always
empty.

I've found that this problem is related to the "cgi.fix_pathinfo" option.
When this option is set to 1 -- the default in PHP 5.0.5 -- PATH_INFO is
always empty. When this option is set to 0 -- the default in PHP 4.4.0 --
PATH_INFO is set correctly.

This same(?) issue was reported in Bug #23800, but apparently the reporter
was content with just setting cgi.fix_pathinfo=0 and closing the report.
The actual problem with PATH_INFO being empty when cgi.fix_pathinfo=1 went
unaddressed.

I do not see any reason to believe this behavior is correct. The (rather
vague) documentation for cgi.fix_pathinfo states:

"...For more information on PATH_INFO, see the cgi specs. Setting this to
1 will cause PHP CGI to fix it's paths to conform to the spec."

The CGI specs certainly don't say that PATH_INFO should be an empty
string, so we aren't seeing increased conformance with the spec here. On
the contrary, setting PATH_INFO to an empty string when there is path info
introduces non-conformance with the spec.


My PHP configure line:
./configure --prefix=/usr/local/php-cgi --enable-track-vars --with-mysql
--with-zlib --with-openssl --enable-discard-path

Reproduce code:
---------------
Create a file named "test.cgi" with these four lines:

#!/usr/local/php-cgi/bin/php
<?php
phpinfo();
?>

Give it execute permission (chmod +x), and place it in <document
root>/cgi-bin. Then open the following URL:

http://<hostname>/cgi-bin/test.cgi/extrapathinfo

Expected result:
----------------
In the Environment table, I expect to see the following:

PATH_INFO        /extrapathinfo

Actual result:
--------------
PATH_INFO        no value
ORIG_PATH_INFO   /extrapathinfo

(PHP has copied the original PATH_INFO value to ORIG_PATH_INFO, and
cleared PATH_INFO.)

-- 
Edit bug report at http://bugs.php.net/?id=34554&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34554&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34554&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34554&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34554&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34554&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34554&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34554&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34554&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34554&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34554&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34554&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34554&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34554&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34554&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34554&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34554&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34554&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34554&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34554&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34554&r=mysqlcfg

Reply via email to