23

I have Ubuntu 11.10 and installed php5-fpm and I want to configure nginx. I want to use unix sockets instead of tcp sockets but I couldn't find the

 /var/run/php5-fpm.sock

I have looked also

/tmp/php5-fpm.sock

Where is php5-fpm.sock file? I also tried

locate php5-fpm.sock

but I couldn't find anything. Note: php5-fpm is working . I have started as a service http://blog.bigdinosaur.org/wordpress-on-nginx/ http://blog.nas-admin.org/?p=25

2 Answers 2

33

In the default configuration before 12.10 Quantal, PHP FPM is set to listen on TCP port 9000 on address 127.0.0.1. This can be changed in /etc/php5/fpm/pool.d/www.conf.

Look for the line:

listen = 127.0.0.1:9000

and change it to something like:

listen = /var/run/php5-fpm.sock

After doing so, restart PHP FPM:

sudo /etc/init.d/php5-fpm restart

(note: reload is broken on Oneiric as it sends a HUP signal to php5-fpm which is wrong. It's fixed in Precise by sending USR2, bugreport).

Note: as mentioned by @SpamapS (palingdrome :D), newer releases use Unix sockets by default, not the tcp socket. See this Launchpad comment, it got changed in 12.10 Quantal.

4
  • Just a note, on precise, php5-fpm actually runs on a socket by default. ;)
    – SpamapS
    Apr 27, 2012 at 20:40
  • 5
    @SpamapS I don't think so, the changelog does not mention anything. Just to be sure, I checked the php5-fpm .deb package for version 5.3.10-1ubuntu3 and it still contains listen = 127.0.0.1:9000. Perhaps you've previously changed this and upgraded while keeping the conffiles?
    – Lekensteyn
    Apr 27, 2012 at 21:25
  • 1
    Well no, I submitted the change to Debian, and they merged it, but only to the PHP 5.4 packages. I actually mistakenly set the bug status on pad.lv/900620 , so thanks for the heads up, set it back to Triaged. We'll pick it up on the next merge from Debian.
    – SpamapS
    Apr 28, 2012 at 0:53
  • In 14.04, it appears to use a UNIX socket by default, so things must have changed. Apr 30, 2014 at 9:47
1

Unfortunately this method is old and will no longer work . OLD

sudo /etc/init.d/php5-fpm restart

Now a days you need to use

sudo service php5-fpm restart

In place of restart you may also use; start, stop and reload.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .