Issue
Summary:I'm trying to use Nginx on PHP7.2 and CentOS 7, but can't find php-fpm.sock
I used to use PHP7.0 on Ubuntu 16. Recently, I switched to CentOS 7. and now I'm trying to set it up with Nginx and the latest PHP (i.e. PHP7.2)
On PHP7.0 on Ubuntu 16, the php-fpm's socket file was stored in...
/run/php/php7.0-fpm.sock
However, on PHP7.2. and CentOS7, I don't see /run/php/
directory. So, it's clear that Nginx on PHP7.2 and CentOS can't be configured in the say way
I searched Stackoverflow, but most of the posts were dealing with older versions of php (like this one)
If I run yum install php-fpm
, it results in "already installed"
, so I'm sure php-fpm itself is already there
If I run "ps aux | grep php-fpm"...
I can see that there is a directly, named /etc/php-fpm.d
, but it has only a file called www.conf
, not a socket file.
This tutorail shows that the sock is stored as /run/php-fpm/www.sock
on PHP7.2 and CentOS 7, but in my machine, there is only php-fpm.pid
.
So, where did the sock file go? Any advice will be appreciated.
PS:I'm also interested in why Ubuntu+PHP7 and CentOS+PHP7.2 have such a difference regarding where to store PHP files
Solution
The two distros (Ubuntu and CentOS) are using different package mechanisms (apt
vs yum
), different packages and different maintainers with different approach to things. So you may expect quite some difference in how things are structured or even work between the two systems.
The default PHP-FPM config by Remi, indeed has one pool listening on port 9000 (AFAIK).
If you want it to listen on a Unix socket, you have to adjust the PHP-FPM pool config. That is /etc/php-fpm.d/www.conf
. So you'll want to specify there:
listen = /var/run/php-fpm/php-fpm.sock
This is just to give you an idea :)
Answered By - Danila Vershinin