php-fpm check before sending to AddHandler (TEMPLATES)

Version 1.561

Feature
Finished

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: https://wiki.apache.org/httpd/PHP-FPM Credit to zEitEr on the forum for finding/posting the solution: https://forum.directadmin.com/showthread.php?t=57464&p=294785#post294785

Interested to try DirectAdmin? Get a 30-day Free Trial!