问题原文
原帖链接 · Esa Jokinen · CC BY-SA 3.0
I'm using Debian 9 with PHP-FPM 7.0.26-2 & 5.6.32-1 from repository deb.sury.org. The same configuration is working fine on a Debian 8 server with PHP-FPM 5.6.30
- I've copied the
pool.d/user.conffrom that server. - Both
php.inifiles are havingcgi.fix_pathinfo=1. - The parameter is also forced using
php_admin_value[cgi.fix_pathinfo] = 1. Both servers uses this pool similarly from
<VirtualHost>context with:ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/user.sock|fcgi://localhost/home/user/public_html
Now, there's an AJAX page that needs to read path from PATH_INFO (possibly PATH_TRANSLATED). However, while these variables have correct content on the Debian 8 server:
["SCRIPT_NAME"]=>
string(14) "/path/ajax.php"
["ORIG_SCRIPT_NAME"]=>
string(25) "/path/ajax.php/para/meters"
["PATH_INFO"]=>
string(12) "/para/meters"
["PATH_TRANSLATED"]=>
string(34) "/home/user/public_html/para/meters"
They seem to work differently on the fresh Debian 9 + dub.sury.org:
["SCRIPT_NAME"]=>
string(25) "/path/ajax.php/para/meters"
["PATH_TRANSLATED"]=>
string(22) "/home/user/public_html"
And the prameters ORIG_SCRIPT_NAME and PATH_INFO are completely missing.
已采纳解答
原帖链接 · Esa Jokinen · CC BY-SA 3.0
It was the way I used the proxy_fcgi. As explained in the examples for mod_proxy_fcgi:
You can also force a request to be handled as a reverse-proxy request, by creating a suitable Handler pass-through. - - The benefit of this form is that it allows the normal mapping of URI to filename to occur in the server, and the local filesystem result is passed to the backend. When FastCGI is configured this way, the server can calculate the most accurate
PATH_INFO.
So I replaced my
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/user.sock|fcgi://localhost/home/user/...
with a Handler & Worker:
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php/user.sock|fcgi://localhost"
</FilesMatch>
<Proxy "fcgi://localhost/" enablereuse=on max=10>
</Proxy>
Now all the AJAX request are working fine.
BONUS: If some knows why the ProxyPassMatch was able to calculate the the PATH_INFO before on my Debian 8 / Apache 2.4.10 / PHP-FPM 5.6.30 but not with Debian 9, that would be awesome.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
