Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php-fpm doesn't create .sock file

Tags:

php

php-7

centos

I have an AWS server running on Amazon Linux.

I used this guide to install php7 (bottom of the page): https://forums.aws.amazon.com/thread.jspa?messageID=695576

I would like to use nginx instead of Apache, so I've also installed the php70w-fpm and nginx packages. However, when I service start php-fpm, it does not create a php-fpm.sock file anywhere on my server. I have checked in /var/run and have also ran find / -name "*.sock" which only returns /var/run/rpcbind.sock.

like image 301
Kezaia Avatar asked Feb 12 '16 16:02

Kezaia


People also ask

Does PHP-FPM use PHP INI?

fpm/php. ini will be used when PHP is run as FPM -- which is the case with an nginx installation. And you can check that calling phpinfo() from a php page served by your webserver.

Why is PHP-FPM faster?

The major advantage of PHP-FPM is that it relies on the concept of pool management. Each pool of PHP-FPM can be viewed as a full instance of PHP, having a configuration, limit and restrictions of its own.


2 Answers

Edit: The real solution here is that the listen in www.conf and fastcgi_pass in nginx configuration have to match. Whether you use sockets or tcp is up to you.

The answer was to not use a .sock file at all.

in /etc/php-fpm.d/www.conf it has:

listen = 127.0.0.1:9000

So in my nginx config I put

fastcgi_pass 127.0.0.1:9000;

Instead of using something like

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
like image 64
Kezaia Avatar answered Oct 17 '22 14:10

Kezaia


  1. Make sure you have the following folder and that it's writable. /var/run/php-fpm

  2. then in your www.conf you put: listen = /var/run/php-fpm/php-fpm.sock

  3. then run: sudo service php-fpm restart

  4. then update your nginx.conf: fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  5. and finally restart nginx: sudo service nginx restart
like image 9
Pathaksa Tongpitak Avatar answered Oct 17 '22 15:10

Pathaksa Tongpitak