php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64689 _SERVER["SCRIPT_NAME"] incorrectly evaluated
Submitted: 2013-04-22 08:40 UTC Modified: 2013-04-22 09:09 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: admin at 3dr dot org Assigned:
Status: Not a bug Package: FPM related
PHP Version: 5.3Git-2013-04-22 (Git) OS: FreeBSD 9.1
Private report: No CVE-ID: None
 [2013-04-22 08:40 UTC] admin at 3dr dot org
Description:
------------
I use mod_proxy_fcgi along with FPM:

ProxyPassMatch ^/(.*\.php(/.*)?)$ 
fcgi://172.16.0.11:1007/home/admin/domains/domenaadmina.fulo.inten.pl/public_htm
l/$1 timeout=180

Using scripts like this:
/glowna/index.php/aaa/bbb/ccc

causes _SERVER["SCRIPT_NAME"] to be wrongly evaluated. Instead of 
/glowna/index.php FPM returns 
/glowna/index.php/aaa/bbb/ccc which obviously also destroys _SERVER["PHP_SELF"].

We've checked it with cgi.fix_pathinfo = 0 (no input file specified error) and 
cgi.fix_pathinfo = 1.
proxy-fcgi-pathinfo = 1 doesn't help to.



Expected result:
----------------
_SERVER["REQUEST_URI"]	/glowna/index.php/aaa/bbb/ccc
_SERVER["SCRIPT_NAME"]	/glowna/index.php
_SERVER["PATH_INFO"]	/aaa/bbb/ccc
_SERVER["ORIG_SCRIPT_FILENAME"]	
/home/admin/domains/domenaadmina.fulo.inten.pl/public_html/glowna/index.php/aaa/bb
b/ccc
_SERVER["PATH_TRANSLATED"]	
/home/admin/domains/domenaadmina.fulo.inten.pl/public_html/aaa/bbb/ccc
_SERVER["PHP_SELF"]	/glowna/index.php/aaa/bbb/ccc

Actual result:
--------------
_SERVER["REQUEST_URI"]	/glowna/index.php/aaa/bbb/ccc
_SERVER["SCRIPT_NAME"]	/glowna/index.php/aaa/bbb/ccc
_SERVER["PATH_INFO"]	/aaa/bbb/ccc
_SERVER["ORIG_SCRIPT_FILENAME"]	
/home/admin/domains/domenaadmina.fulo.inten.pl/public_html/glowna/index.php/aaa/bb
b/ccc
_SERVER["PATH_TRANSLATED"]	
/home/admin/domains/domenaadmina.fulo.inten.pl/public_html/aaa/bbb/ccc
_SERVER["PHP_SELF"]	/glowna/index.php/aaa/bbb/ccc/aaa/bbb/ccc

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-22 08:55 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2013-04-22 08:55 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

$_SERVER variables are passed by the server, PHP doesn't touch it.
 [2013-04-22 09:09 UTC] admin at 3dr dot org
@johannes@php.net
Well - this is not true - FPM is evaluating most of _SERVER variables. Just have 
a 
look at fpm_main.c at line 1198 - that's the place where SCRIPT_NAME is beeing 
evaluated.
When you try to send [E=SCRIPT_NAME:whatever] from Apache side - it's beeing 
immidiatelly overwritten by FPM. 
Go check by yourself.

Luke
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC