W3docs

How to find my php-fpm.sock?

To find your PHP-FPM socket file, you will need to first determine the location of your PHP installation.

To find your PHP-FPM socket file, you need to check the PHP-FPM pool configuration or inspect active system sockets. Note that PHP-FPM uses a separate configuration context from the CLI, so running php -i will not show FPM settings.


Method 1: Check the PHP-FPM pool configuration

PHP-FPM pool configuration files are typically located in /etc/php-fpm.d/ (RHEL/CentOS) or /etc/php/*/fpm/pool.d/ (Debian/Ubuntu). Open the relevant .conf file (often www.conf) and look for the listen directive:

grep "^listen" /etc/php-fpm.d/www.conf

The value after listen = is the path to your PHP-FPM socket file. For example:

listen = /run/php/php8.1-fpm.sock

Method 2: Use ss to find active sockets

If you cannot locate the configuration file, you can find the active PHP-FPM socket by checking system sockets:

ss -lnp | grep php-fpm

This will output the socket path and the associated process. The path listed in the output is your PHP-FPM socket file.

I hope this helps! Let me know if you have any other questions.