php-fpm check before sending to AddHandler (TEMPLATES)

Version 1.56.1


If you access a php file through apache/php-fpm, but it does not exist, this will throw: No input file specified or File not found. A simple solution is to not pass it to php-fpm if it's missing, and let apache throw the usual 404 from the website's setup. To accomplish this, a simple <If ..> check tag can be added around the AddHandler in the VirtualHosts, to look for the REQUEST_FILENAME variable. |*if HAVE_PHP1_FPM="1"| <FilesMatch "\.(inc|php|phtml|phps|php|PHP1_RELEASE|)$"> <If "-f %{REQUEST_FILENAME}"> #ProxyErrorOverride on AddHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost" .inc .php .phtml .php|PHP1_RELEASE| </If> </FilesMatch> |*endif| as per the documentation here, in the "Proxy via handler" section: Credit to zEitEr on the forum for finding/posting the solution:

Try DirectAdmin with a 30-day money back guarantee!