Bug #65641 [Com]: PHP-FPM incorrectly defines the SCRIPT_NAME variable when using Apache

From: Date: Sun, 16 Mar 2014 17:06:52 +0000
Subject: Bug #65641 [Com]: PHP-FPM incorrectly defines the SCRIPT_NAME variable when using Apache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184800@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65641&edit=1 ID: 65641 Comment by: ryotakatsuki at gmail dot com Reported by: ryotakatsuki at gmail dot com Summary: PHP-FPM incorrectly defines the SCRIPT_NAME variable when using Apache Status: Assigned Type: Bug Package: FPM related PHP Version: 5.5.3 Assigned To: fat Block user comment: N Private report: N New Comment: I added fix_script_name_in_fpm_with_apace_fixed that fixes the previous one (it seems it was an outdated buggy one, wrong malloc call...). I cannot (or don't know how) remove the old one. In case someone finds it useful :). Previous Comments: ------------------------------------------------------------------------ [2014-03-14 16:20:45] hp4everything at googlemail dot com This problem is still unsolved in release 5.5.10. The archlinux distribution just updated their packages from apache2.2+mod-php to apache2.4 + php-fpm. But since php-fpm does not provide a correct content for the array $_SERVER (at least SCRIPT_NAME seems to be wrong) php-based websites won't run with apache2.4+php-fpm. e.g the software "owncloud" is not able to run on php-fpm. Is it possible to provide a source correction based on the available patch (if that has been tested) in one of the next php-releases for standard Linux-distributions? ------------------------------------------------------------------------ [2013-09-09 09:12:30] ryotakatsuki at gmail dot com Description: ------------ When using Apache + PHP_FPM, the SCRIPT_NAME variable is incorrectly set. For example, accessing "http://127.0.0.1/sample/test.php/a/b/c", results in: ORIG_SCRIPT_NAME: SCRIPT_NAME: /sample/test.php/a/b/c ORIG_SCRIPT_FILENAME: //tmp/sample/test.php/a/b/c SCRIPT_FILENAME: //tmp/sample/test.php PATH_INFO: /a/b/c ORIG_PATH_INFO: While when using mod_php, the values are: SCRIPT_NAME: /sample/test.php SCRIPT_FILENAME: /tmp/sample/test.php PATH_INFO: /a/b/c It is also working fine when using NGINX Test script: --------------- A sameple script to reproduce the issue: <?php echo("ORIG_SCRIPT_NAME: " . $_SERVER['ORIG_SCRIPT_NAME']); echo('<br/>'); echo("SCRIPT_NAME: " . $_SERVER['SCRIPT_NAME']); echo('<br/>'); echo("ORIG_SCRIPT_FILENAME: " . $_SERVER['ORIG_SCRIPT_FILENAME']); echo('<br/>'); echo("SCRIPT_FILENAME: " . $_SERVER['SCRIPT_FILENAME']); echo('<br/>'); echo("PATH_INFO: " . $_SERVER['PATH_INFO']); echo('<br/>'); echo("ORIG_PATH_INFO: " . $_SERVER['ORIG_PATH_INFO']); echo('<br/>'); ?> And a very simple apache conf: Alias /sample /tmp/sample ProxyPassMatch .*/sample/(test.php.*) fcgi://127.0.0.1:9000//tmp/sample/$1 <Directory /tmp/sample/ > Require all granted </Directory> Expected result: ---------------- ORIG_SCRIPT_NAME: SCRIPT_NAME: /sample/test.php ORIG_SCRIPT_FILENAME: //tmp/sample/test.php/a/b/c SCRIPT_FILENAME: //tmp/sample/test.php PATH_INFO: /a/b/c ORIG_PATH_INFO: ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65641&edit=1

« previous php.bugs (#184800) next »