Apache 2.4 – Fix PHP Status Page Not Working

apache-2.4php-fpm

Using PHP7.3 FPM along with Apache 2.4.25 I have a problem when enabling PHP FPM status page.

What is working:

# /etc/php/7.3/fpm/pool.d/www.conf
listen = /run/php/php7.3-fpm.sock
pm.status_path = /status-php

# /etc/apache2/sites-enabled/status.conf
<VirtualHost [::1]:80 127.0.0.1:80>
        ServerName localhost
        DocumentRoot /var/www
        <Location /status-php>
                SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"
        </Location>
</VirtualHost>

But what does not work is replacing /status-php with /status/php in both files (PHP and Apache config). This results in 404 and an Apache error saying:

AH01071: Got error 'Primary script unknown'

What is the reason for that? Why is the subfolder-variant not working?

Best Answer

I solved it my own by replacing

<Location /status-php>
    SetHandler "proxy:unix:/run/php/php7.3-fpm.sock|fcgi://localhost"
</Location>

with

ProxyPass "/status/php" "unix:/run/php/php7.3-fpm.sock|fcgi://localhost"

This way, I can reach PHP-FPM status page via /status/php now. No clue why Apache handler fails.

Related Topic