php5-fpm ping and status pages error out? LimitInternalRecursion error?

I have php5-fpm running just fine. My entire site is running as expected, almost no issues. However, I am unable to make use of the ping and status pages. When I navigate to or I get an error (403, 404, 500, depends on the config).

I’m very new to the LAMP stack. I’ve been thrown to the wolves on this, but I’ve got to get it figured out.

I’ll include anything I think is pertinent below, but if I miss something cue me in, thanks in advance for your patience!

Running Ubuntu 14.04
Apache 2.4
PHP 5.5

Mods enabled in Apache (the important ones at least):

  • mpm_event
  • fastcgi
  • actions
  • alias

I’m going to leave out the majority of the FPM configuration because it is functioning, but here’s the ping and status settings… Pretty vanilla setup.

pm.status_path = /status
ping.path = /ping

Listening on a socket to reduce tcp/ip overhead…

listen = /var/run/php5-fpm.sock

I have php5-fpm.conf configured in /etc/apache2/conf-available/ and a symlink in conf-enabled, the contents of which are:

<IfModule mod_fastcgi.c>

    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

    <LocationMatch "/(ping|status)">
        SetHandler php5-fcgi-virt
        Action php5-fcgi-virt /php5-fpm-handler.fcgi virtual


Most of the documentation I’ve found makes reference to the LocationMatch as the only hotfix needed to get the ping and status pages working. I’m not sure where to go from here. I’ve tried everything I can find on the web to no avail. I’ve made various changes to the php5-fpm.conf file and each change either has no effect or leads me to a different error. I’ve encountered internal server error’s, permissions issues, etc. With this setup I’m currently getting a 500 internal server error.

All help is beyond appreciated!

EDIT 09Feb2015:

After reading this helpful guide here I’ve replaced the LocationMatch in php5-fpm.conf with:

<FilesMatch "^ping|status$">
    SetHandler php-script

This did not fix the problem, but did change the effect. I’m now receiving a 404 Error. Still not sure what I’m missing here…

EDIT 10Feb2015:

I’ve gone back to the more popular notion that the LocationMatch is correct and the FilesMatch will not get me closer to success. Again, very new to hosting and LAMP servers in general, but I found that when I get a 404 Error (using the FilesMatch) nothing is logged in /var/log/apace2/error.log, but when using the LocationMatch I still get a 500 Error, and I get a log entry:

[Tue Feb 10 00:29:17.216917 2015] [core:error] [pid 8978:tid 140200547378944] [client IP:Port] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

I’ve done a little digging around the web, but cannot find good documentation describing a fix for this issue. Any Ideas?

Asked By: Erick Christian


I had the same problem. With lots of Google-ing and trying I figured it out.

You need to match what you setup in your virtual host with whats configured in the fastcgi.conf (of php-fpm.conf).

Furthermore its beter to use ‘/fpm-status’ and ‘/fpm-ping’ in the /etc/php5/fpm/pool.d/www.conf config. Then you should not have conflicts with Apache’s own ‘status’ page.

So this is my fastcgi.conf:

<IfModule mod_fastcgi.c>
    AddType application/x-httpd-fastphp5 .php
    Action application/x-httpd-fastphp5 /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
    <Directory /usr/lib/cgi-bin>
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Require all granted
            Order allow,deny
            Allow from all

And this is what I added in my Apache 000-default.conf:

<LocationMatch "/(fpm-ping|fpm-status)">
     SetHandler php5-fcgi-virt
     Action php5-fcgi-virt /php5-fcgi virtual

If you don’t limit access to your default Apache vhost you should add it in the LocationMatch for the fpt-ping and fpm-status:

     Order deny,allow
     Deny from all
     Allow from <your-IP>

To allow using php-fpm per virtual host just keep the ‘standard’ and add this next lines to your virtual host to redirect all php files to the php-fpm:

    <FilesMatch "[345]?|t|tml)$">
            SetHandler application/x-httpd-fastphp5

Happy php-fpm’ing!!!

Answered By: Harold Snel
Categories: Answers Tags: , , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.