Where is php7.0-fpm.sock located (ok)
https://stackoverflow.com/questions/44757189/where-is-php7-0-fpm-sock-located
Last updated
https://stackoverflow.com/questions/44757189/where-is-php7-0-fpm-sock-located
Last updated
144
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:
but I can't find php/php7.0-fpm.sock;
I have the following path in my centos distro
php nginx unix-socketshareimprove this questionedited Feb 27 '18 at 13:17asked Jun 26 '17 at 10:00hidar2,24944 gold badges2222 silver badges4949 bronze badgesadd a comment
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.
Check the directory if socket file was created:
Where is located in ubutnu? – Yasar Arafath Aug 19 '17 at 19:44
1I only see php7.0-fpm.pid file – Yasar Arafath Aug 19 '17 at 19:45
1I am running several ubuntus. Default path (I've never changed this): /var/run/php/php7.0-fpm.sock. But again it is depending on the config value and this file should be created if php-fpm is starte. – BenRoob Aug 19 '17 at 19:56
But there is only one file php7.0-fpm.pid – Yasar Arafath Aug 19 '17 at 20:13
1lol i can understand why Ben gave up! XD yasar did you come right? – emotality Mar 22 '18 at 17:46
show 3 more comments11+25
First check if php-fpm
is running on your system, for doing this you could use pgrep
for example:
In this case, it shows is up and running and using the configuration file /etc/php-fpm.conf
. Before checking the configuration file and trying to check for the listen =
directive you could quickly look into /proc/net/unix
for example:
Which may return something like:
In this case, it shows that the path for the php-fpm socket is located in /tmp/php-fpm.sock
the one could be verified by checking the conf in /etc/php-fpm.d/www.conf
in this case being: listen= /tmp/php-fpm.sock
In case you don't get any result and php-fpm
is up and running, by checking the configuration you may find that is using the defaults by listing on a TCP socket:
Something you could change to listen on a Unix socket like your suggested conf:
In some Linux distros normally this is used:
After modifying your configuration don't forget to restart the services systemctl restart php-fpm
. To check that the socket has been created you could do:
If socket exists if should print out something like this:
Just to get it right and clear, what is the difference to the other answer? Ok, different paths in centOS. But what else? I thought, I've read somewhere, that it is not recommended to point the socket to /tmp because of security reasons. – BenRoob Aug 1 '18 at 9:42
1@BenRoob mainly focus on finding the location of the socket on a running system something that can be useful also when debugging – nbari Aug 1 '18 at 12:58
1@BenRoob The currently top voted answer fails to address the case when the configuration uses IP:PORT over a socket, in which case the file obviously would not exist. – SeinopSys Aug 4 '18 at 13:53
add a comment2
you can see it by running
It is likely that an older libpcre3 is installed and satisfies the dependency in the php7.0 package, but only the newer library package provides pcre_jit_stack_free.
If this is the case, do an apt-get install libpcre3, and you’re good to go.
Ref.: https://github.com/oerdnj/deb.sury.org/issues/372
Use this:
Output example: listen = /run/php/php7.2-fpm.sock
Or for universal php vesions:
$ cd /run/php && ls -la
shareimprove this answeredited Mar 22 '18 at 17:58emotality10.5k44 gold badges2828 silver badges4949 bronze badgesanswered Jun 26 '17 at 10:15BenRoob1,36044 gold badges1717 silver badges2222 bronze badges
shareimprove this answeredited Aug 1 '18 at 14:46answered Aug 1 '18 at 8:15nbari15.7k44 gold badges3131 silver badges5858 bronze badges
shareimprove this answeranswered Aug 7 '18 at 11:50Breign14688 bronze badgesadd a comment1
I hope this helps you.shareimprove this answeranswered Aug 3 '18 at 11:55rahul singh Chauhan32011 gold badge44 silver badges1414 bronze badgesadd a comment0
shareimprove this answeranswered Oct 10 at 12:21psirus05881add a comment