Php-fpm

From Lolly's Wiki
Revision as of 11:34, 22 September 2023 by Lollypop (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


Health check on command line

Let us assume you have configured your ping in php-fpm an want to try it on a specific socket:

On Ubuntu you need this package to get cgi-fcgi:

# apt install cgi-fcgi

I have configured my socket for my nextcloud pool like this:

# grep -E '^listen' /etc/php/8.1/fpm/pool.d/nextcloud.conf 
listen = /run/php/php-fpm.nextcloud.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0600

And the ping like this:

# grep -E '^ping\.' /etc/php/8.1/fpm/pool.d/nextcloud.conf 
ping.path = /fpm-ping
ping.response = pong

Then I can send a ping directly to this socket (not through the webserver) like this:

# SCRIPT_NAME=/fpm-ping  SCRIPT_FILENAME=/fpm-ping  REQUEST_METHOD=GET /usr/bin/cgi-fcgi -bind -connect /run/php/php-fpm.nextcloud.sock  ; echo
Content-type: text/plain;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0

pong