Thursday, April 14, 2016

Apache mod_proxy_fcgi and PHP-FPM (php-cgi.exe) issue (No input file specified.) on Windows

Leave a Comment

The following is PHP-FPM (PHP 5.5)

php-cgi.exe -b 127.0.0.1:9000 

The following is mod_proxy_fcgi (Apache 2.4)

The first way

<Files ~ "\.(php|phtml)$">     SetHandler "proxy:fcgi://127.0.0.1:9000/" </Files> 

The second way

<LocationMatch ^(.*\.(php|phtml))$>     ProxyPass fcgi://127.0.0.1:9000/$1 </LocationMatch> 

The third way

<IfModule mod_rewrite.c>     RewriteCond %{REQUEST_FILENAME} -f     RewriteRule ^([^\.]+\.(php|phtml))$ fcgi://127.0.0.1:9000/$1 [P,L] </IfModule> 

The above three ways will get an error "No input file specified." Anybody know why? How should I do to solve this problem?

1 Answers

Answers 1

I think this is a bug in mod_proxy_fcgi, connected to an issue resolved in Apache 2.4.12 onwards:

mod_proxy_fcgi: Remove proxy:balancer:// prefix from SCRIPT_FILENAME passed to fastcgi backends. [Eric Covener]

Here is a link

Unfortunatelly it was not good enough as Apache is sending the SCRIPT_FILENAME with a starting slash, similar to \c:\fileName.php, which is not resolved as a local file name and is never executed. You may verify this using a network sniffer(Wireshark) listening on your FastCGI port.

I will be more than happy to see this issue resolved officially since I am not confident in recompiling Apache by myself and so I am using distributions from apachelounge.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment