With Apache 2.4.26 using php-fpm 7.1.6, $_SERVER['SCRIPT_FILENAME']
(and $_SERVER['PHP_SELF']
) is incorrect on a folder:
Apache 2.4.26:
/index.php
Apache 2.4.25:
/myfolder/index.php
What is wrong?
I fixed it in apache config with this new config directive :
ProxyFCGIBackendType GENERIC
In global configuration before the SetHandler directive. Default is FPM, but it's not correct with some php-fpm configuration (SetHandler and socket).
With this bug all $_SERVER['SCRIPT_FILENAME']
and $_SERVER['PHP_SELF']
Apache vars ($_SERVER
) (injected from php-fpm) are wrong, they don't have the path!
ProxyFCGIBackendType is default to FPM but it's wrong for many configuration. Apache httpd should add GENERIC as default to don't break websites.
See: https://httpd.apache.org/docs/2.4/en/mod/mod_proxy_fcgi.html#proxyfcgibackendtype