From 5ab49e3f5093b9bac6a8a35741cfd4a725f39b97 Mon Sep 17 00:00:00 2001 From: Manuel Date: Fri, 21 Jan 2022 12:25:14 +0100 Subject: [PATCH] Call PHP-FPM only when file exists (#1006) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added `` to load only PHP files that exists. This is to prevent `File not found` error from PHP-FPM and let Apache handle the error output. It removes also unnecessary PHP-FPM calls and `AH01071: Got error ‘Primary script unknown` in PHP error log. Usually you can find the error whenever someone goes fishing for paths like wp-login.php. The `` directive is only available in Apache 2.4+ and not 2.2 or earlier. --- lib/Froxlor/Cron/Http/ApacheFcgi.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Froxlor/Cron/Http/ApacheFcgi.php b/lib/Froxlor/Cron/Http/ApacheFcgi.php index 1582144a..bc92455d 100644 --- a/lib/Froxlor/Cron/Http/ApacheFcgi.php +++ b/lib/Froxlor/Cron/Http/ApacheFcgi.php @@ -56,7 +56,9 @@ class ApacheFcgi extends Apache // start block, cut off last pipe and close block $filesmatch = '(' . str_replace(".", "\.", substr($filesmatch, 0, - 1)) . ')'; $php_options_text .= ' ' . "\n"; - $php_options_text .= ' SetHandler proxy:unix:' . $domain['fpm_socket'] . '|fcgi://localhost' . "\n"; + $php_options_text .= ' ' . "\n"; + $php_options_text .= ' SetHandler proxy:unix:' . $domain['fpm_socket'] . '|fcgi://localhost' . "\n"; + $php_options_text .= ' ' . "\n"; $php_options_text .= ' ' . "\n"; $mypath_dir = new \Froxlor\Http\Directory($domain['documentroot']);