ID: 21261 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Scripting Engine problem Operating System: linux 2.4.18 - slack 8.1 PHP Version: 4.3.0 Assigned To: shane New Comment:
Quick & Dirty PHP-Based workaround: Put this code in a file and add it to auto_prepend_file-directive in php.ini: -snip---------------------------------------- // Small Workaround for a bug in PHP 4.3.0/cgi // See http://bugs.php.net/bug.php?id=21261 for details $_SERVER['SCRIPT_NAME'] = substr($_SERVER['PATH_TRANSLATED'], strlen($_SERVER['DOCUMENT_ROOT'])); $PHP_SELF = $SCRIPT_NAME = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; -snip------------------------------------ Works fine for me... If PHP is used as CLI it may be neccessary to check current mode before running this code. Previous Comments: ------------------------------------------------------------------------ [2003-01-07 13:30:23] [EMAIL PROTECTED] There is no space in SCRIPT_NAME on my localhost, this was an copy&paste-error. But the "I" at the end exists. ------------------------------------------------------------------------ [2003-01-07 13:27:55] [EMAIL PROTECTED] Same for me, your patch seems to have no affect. I checked the debugging output from cgiwrap which says: [...] Fixing Environment Variables. Environment Variables: QUERY_STRING: '' SCRIPT_NAME: '/phpinfo.php' SCRIPT_FILENAME: '<DOCUMENT_ROOT>/phpinfo.php' REDIRECT_URL: '<NULL>' PATH_INFO: '/phpinfo.php' PATH_TRANSLATED: '<DOCUMENT_ROOT>/phpinfo.php' REMOTE_USER: '<NULL>' REMOTE_HOST: '<NULL>' REMOTE_ADDR: '217.4.137.70' [...] Seems to be ok?! But PHP_SELF has no value. On my localhost PHP 4.3/CGI works with cgiwrap. The same paragraph with this machine: [...] Fixing Environment Variables. Environment Variables: QUERY_STRING: '' SCRIPT_NAME: '/php/ phpinfo.phpI' SCRIPT_FILENAME: '<DOCUMENT_ROOT>/php/phpinfo.php' REDIRECT_URL: '' PATH_INFO: '/php/phpinfo.php' PATH_TRANSLATED: '<DOCUMENT_ROOT>/php/phpinfo.php' REMOTE_USER: '' REMOTE_HOST: '' REMOTE_ADDR: '192.168.23.2' [...] In this case, script_name is broken for some reason (don't ask me why, i didn't find out). But PHP_SELF has the correct value! On both server SCRIPT_NAME isn't listed in the phpinfo()-Output. Hope this will help. ------------------------------------------------------------------------ [2003-01-07 00:42:23] [EMAIL PROTECTED] [EMAIL PROTECTED]: email me your httpd.conf, php.ini and the test script you use. You can remove anything from the files that are private. Also, as per spec PATH_TRANSLATED will be empty unless you have PATH_INFO, which is path data *after* the script in a url: http://host/script.php/path/info?query-string The only thing I'm concerned about is the garbled PHP_SELF. PHP_SELF is the same as SCRIPT_NAME, is SCRIPT_NAME also garbled? ------------------------------------------------------------------------ [2003-01-06 11:06:47] [EMAIL PROTECTED] Negative. Patch not only did not work (I applied it to current 4.3.0) but I now no longer have a $_SERVER['PATH_TRANSLATED'] variable . So $_SERVER['PHP_SELF'] remains corrupted and $_SERVER['PATH_TRANSLATED'] gives some kind of udefined error. Joshua ------------------------------------------------------------------------ [2003-01-05 21:58:19] [EMAIL PROTECTED] The patch at http://www.caraveo.com/php/cgi.patch Should fix this problem. Please try this and let me know. It's against cvs HEAD from today. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21261 -- Edit this bug report at http://bugs.php.net/?id=21261&edit=1