Score:1

php7.4-fpm / Apache2: Getting PHP FPM Status Page To Load?

gb flag

I'm trying to get my php7.4-fpm status page to show up on an URL. I'm running an Apache 2.4.41 server. Instead, I am getting a "File Not Found." error.

Here is what I've done. First I edited:

/etc/php/7.4/fpm/pool.d/www.conf

I uncommented and edited two lines:

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

Next, I went to my website's apache configuration file:

/etc/apache2/sites-enabled/mywebsite.com.conf

and added the lines:

<VirtualHost *:443>
  ServerAlias mywebsite.com
  DocumentRoot /home/mywebsite/mywebsite.com

  # added these lines to get the php status page to show up
  <LocationMatch "/(ping|status)">
    SetHandler "proxy:unix:/run/php/php7.4-fpm.mywebsite.sock|fcgi://localhost/status"
  </LocationMatch>

</VirtualHost>

It seems like this should be a simple setup, but I've spent hours unsuccessfully trying to get the status page working to diagnose unexplained php-fpm problems that started up a few days ago with all the php-fpm processes being used on all websites.

Now I'm resigned to playing the shotgun game trying different handlers in an attempt to get something working:

SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost/status"
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost/"
SetHandler "proxy:unix:/run/php/php7.4-fpm.mywebsite.sock|fcgi://localhost"

If I try "proxy:unix:/run/php/php7.4-fpm.sock", which is what the www.conf actually listens on, I get a 503 Service Unavailable.

If I try my website socket "proxy:unix:/run/php/php7.4-fpm.mywebsite.sock", the page actually loads up, but it just shows a "File Not Found", and it doesn't matter if it's "fcgi://localhost/status" or "fcgi://localhost". I don't know what the deal is.

Score:0
gb flag

After taking a break and eating food, I figured this out in minutes. If anyone else has the same problem, you must edit your individual site's pool conf, not the [www] one.

/etc/php/7.4/fpm/pool.d/mywebsite.conf

Then add to that:

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

In my case, I never use www.conf. Instead, I have a VPS setup where each site has it's own pool, and apache just doesn't use www.conf.

The next step is to use the socket corresponding to your individual site's pool conf, such as the following for your Apache:

proxy:unix:/run/php/php7.4-fpm.mywebsite.sock|fcgi://localhost/status

sudo systemctl reload php7.4-fpm
sudo systemctl reload apache2

Thanks for looking. I'll probably come across my own post again some years later, so to my future self, this is how it's done. Don't forget to use the URL https://www.mywebsite.com/status?full for the full list of each individual process, not just the summary.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.