Where is php7.0-fpm.sock located

hidar picture hidar · Jun 26, 2017 · Viewed 37.3k times · Source

I have a simple project with directory structure

I am setting up nginx config for my drupal site, and for the fastcgi_pass I have been using 127.0.0.1:9000 but I want to use a unix socket as suggested in this conf:

 # PHP 7 socket location.
   fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

but I can't find php/php7.0-fpm.sock;

I have the following path in my centos distro

/var/run/php-fpm/php-fpm.pid

Answer

BenRoob picture BenRoob · Jun 26, 2017

Check the php-fpm config where the socket will be created with:

$ cat /etc/php/7.0/fpm/pool.d/www.conf

Look for listen, for example:

listen = /run/php/php7.0-fpm.sock

php-fpm creates the socket file after you started the process.

sudo service php7.0-fpm stop
sudo service php7.0-fpm start

Check the directory if socket file was created:

$ cd /run/php && ls -la