Package: php7.3-fpm Version: 7.3.0-2 Severity: minor Tags: patch Dear Maintainer,
The current behavior of php-fpm.conf is to pass URLs for files which match ".+\.ph(ar|p|tml)$" to PHP-FPM regardless of whether the file exists. This causes a few issues: - It prevents Apache error handling (e.g. ErrorDocument). - It adds unnecessary load to PHP-FPM. - It adds unnecessary request overhead for the request. - It causes "AH01071: Got error 'Primary script unknown'" to be logged to the Apache error log for each request. This can be avoided by using an <If> directive around SetHandler, as done on the PHP-FPM page on the Apache Wiki.[1] I have attached a patch which does this. Thanks for considering, Kevin 1. https://wiki.apache.org/httpd/PHP-FPM -- System Information: Debian Release: buster/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (101, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.20.0 (SMP w/4 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages php7.3-fpm depends on: ii libapparmor1 2.13.2-3 ii libargon2-1 0~20171227-0.1 ii libc6 2.28-2 ii libmagic1 1:5.34-2 ii libpcre2-8-0 10.32-3 ii libsodium23 1.0.16-2 ii libssl1.1 1.1.1a-1 ii libsystemd0 240-2 ii libxml2 2.9.4+dfsg1-7+b3 ii mime-support 3.61 ii php7.3-cli 7.3.0-2 ii php7.3-common 7.3.0-2 ii php7.3-json 7.3.0-2 ii php7.3-opcache 7.3.0-2 ii tzdata 2018i-1 ii ucf 3.0038+nmu1 ii zlib1g 1:1.2.11.dfsg-1 php7.3-fpm recommends no packages. Versions of packages php7.3-fpm suggests: ii php-pear 1:1.10.6+submodules+notgz-1 Versions of packages php7.3-common depends on: ii libc6 2.28-2 ii libssl1.1 1.1.1a-1 ii php-common 2:69 ii ucf 3.0038+nmu1 -- Configuration Files: /etc/apache2/conf-available/php7.3-fpm.conf changed [not included] -- no debconf information
>From 2d80e7bd564cce570b8725614e3b73ccd8b74a11 Mon Sep 17 00:00:00 2001 Message-Id: <2d80e7bd564cce570b8725614e3b73ccd8b74a11.1546987306.git.ke...@kevinlocke.name> From: Kevin Locke <[email protected]> Date: Tue, 8 Jan 2019 15:32:19 -0700 Subject: [PATCH] Don't pass URLs for missing files to PHP-FPM When there is no file matching a request URL ending in a matched PHP extension, passing it to PHP-FPM doesn't make sense. It adds unnecessary PHP-FPM load and request overhead, prevents Apache error handling (e.g. ErrorDocument), and causes `AH01071: Got error 'Primary script unknown'` to be logged. Avoid this by using an <If> directive to only configure SetHandler if the requested file exists, as documented on [PHP-FPM] on the Apache Wiki. [PHP-FPM]: https://wiki.apache.org/httpd/PHP-FPM Signed-off-by: Kevin Locke <[email protected]> --- debian/php-fpm.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/php-fpm.conf b/debian/php-fpm.conf index 3fc2f80c0..1d78fbb48 100644 --- a/debian/php-fpm.conf +++ b/debian/php-fpm.conf @@ -7,7 +7,9 @@ </IfModule> <FilesMatch ".+\.ph(ar|p|tml)$"> - SetHandler "proxy:unix:/run/php/php@[email protected]|fcgi://localhost" + <If "-f %{REQUEST_FILENAME}"> + SetHandler "proxy:unix:/run/php/php@[email protected]|fcgi://localhost" + </If> </FilesMatch> <FilesMatch ".+\.phps$"> # Deny access to raw php sources by default -- 2.20.1

