I am having some problems with ubuntu and php5-fpm on my VPS. Php works fine, however it throws terminal error when I am trying to reload / restart / stop it. Basically, I cannot stop php because it does not recognize the instance
It says "reload: Unknown instance:" If I try "service php5-fpm restart" it sais unknown instance and gives this in logs
[15-Nov-2013 11:56:40] ERROR: An another FPM instance seems to already listen on /var/run/php5-fpm.sock [15-Nov-2013 11:56:40] ERROR: FPM initialization failed [15-Nov-2013 11:56:40] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful
I have php listening on /var/run/php5-fpm.sock ; I use nginx for webserver and it is correctly configured with
fastcgi_pass unix:/var/run/php5-fpm.sock;
(or so I know) Also need to mention that this happened after a reboot.
Site is working well, however I don't think this is a good sign. Any thoughts ? Thank you.
EDIT : I did as suggested in below post. It seems that if i kill the process, and then use start/stop it works fine. However, after I use reload command, it stops recongizing the instance.
root@developer2:/# service php5-fpm stop stop: Unknown instance: root@developer2:/# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 Nov14 ? 00:00:00 init root 1101 1 0 Nov14 ? 00:00:00 /sbin/udevd --daemon root 1168 1 0 Nov14 ? 00:00:00 /usr/sbin/sshd -D root 1227 1 0 Nov14 ? 00:00:00 /usr/sbin/xinetd -dontfork -pidfile /var/run/xinetd.pid -stayalive -inetd_compa root 1229 1 0 Nov14 ? 00:00:00 cron mysql 1249 1 0 Nov14 ? 00:00:18 /usr/sbin/mysqld syslog 1283 1 0 Nov14 ? 00:00:00 /sbin/syslogd -u syslog memcache 1293 1 0 Nov14 ? 00:00:07 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 root 1426 1 0 Nov14 ? 00:00:00 /usr/lib/postfix/master postfix 1440 1426 0 Nov14 ? 00:00:00 qmgr -l -t fifo -u root 1468 1 0 Nov14 ? 00:00:00 /usr/sbin/varnishd -P /var/run/varnishd.pid -a :80 -T localhost:6082 -f /etc/va nobody 1469 1468 0 Nov14 ? 00:01:14 /usr/sbin/varnishd -P /var/run/varnishd.pid -a :80 -T localhost:6082 -f /etc/va root 1593 1 0 Nov14 ? 00:00:14 /usr/bin/python /usr/bin/fail2ban-server -b -s /var/run/fail2ban/fail2ban.sock root 1595 1 0 Nov14 ? 00:00:00 /usr/lib/gamin/gam_server www-data 3535 1 0 Nov14 ? 00:00:30 php-fpm: pool www postfix 10016 1426 0 11:18 ? 00:00:00 pickup -l -t fifo -u -c root 10064 1168 0 11:37 ? 00:00:00 sshd: root@pts/0 root 10080 10064 0 11:37 pts/0 00:00:00 -bash root 10143 1168 0 11:47 ? 00:00:00 sshd: root@notty root 10159 10143 0 11:47 ? 00:00:00 /usr/lib/openssh/sftp-server root 11330 1 0 12:03 ? 00:00:00 nginx: master process /usr/sbin/nginx www-data 11331 11330 0 12:03 ? 00:00:00 nginx: worker process www-data 11332 11330 0 12:03 ? 00:00:00 nginx: worker process www-data 11333 11330 0 12:03 ? 00:00:00 nginx: worker process www-data 11334 11330 0 12:03 ? 00:00:00 nginx: worker process root 11465 1168 0 12:14 ? 00:00:00 sshd: root@notty root 11481 11465 0 12:14 ? 00:00:00 /usr/lib/openssh/sftp-server root 11519 10080 0 12:23 pts/0 00:00:00 ps -ef root@developer2:/# kill 3535 root@developer2:/# service php5-fpm start php5-fpm start/running, process 11529 root@developer2:/# service php5-fpm stop php5-fpm stop/waiting root@developer2:/# service php5-fpm start php5-fpm start/running, process 11544 root@developer2:/# service php5-fpm stop php5-fpm stop/waiting root@developer2:/# service php5-fpm start php5-fpm start/running, process 11559 root@developer2:/# service php5-fpm reload root@developer2:/# service php5-fpm reload reload: Unknown instance:
Edit 2 : my php5 seems to create 3 processes
root 11813 1 1 12:34 ? 00:00:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) www-data 11815 11813 0 12:34 ? 00:00:00 php-fpm: pool www www-data 11816 11813 0 12:34 ? 00:00:00 php-fpm: pool www
When I use reload function the master process dissapears and I have to manually kill the other 2 processes in order to be able to correctly start it again.
This is a Ubuntu bug. In /etc/init/php5-fpm.conf, there is a commented-out line reload signal USR2
, which causes the reload function to terminate the php5-fpm master process by sending SIGHUP. Any further reloads, restarts or stops will fail, because the master process has been terminated.
I fixed this in Ubuntu 14.04 by creating a file /etc/init/php5-fpm.override
with the single line reload signal USR2
in it. Credits to Jurian Sluiman's comment in this answer.
Here is the primary bug report, proposed workarounds, and confirmation of workaround.
$ ps aux | grep php USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1966 0.0 0.9 473276 37040 ? Ss 10:03 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) www-data 2009 0.0 1.5 478280 62500 ? S 10:03 0:01 php-fpm: pool www www-data 2011 0.0 1.3 476504 55220 ? S 10:03 0:00 php-fpm: pool www www-data 2012 0.0 1.6 481592 65840 ? S 10:03 0:00 php-fpm: pool www $ sudo service php5-fpm status php5-fpm start/running, process 1966 $ sudo service php5-fpm stop php5-fpm stop/waiting $ sudo service php5-fpm status php5-fpm stop/waiting $ sudo service php5-fpm start php5-fpm start/running, process 2651 $ sudo service php5-fpm status php5-fpm start/running, process 2651 $ ps aux | grep php USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2651 0.2 0.9 473276 36996 ? Ss 10:35 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) www-data 2654 0.0 0.1 473276 7104 ? S 10:35 0:00 php-fpm: pool www www-data 2655 0.0 0.1 473276 7104 ? S 10:35 0:00 php-fpm: pool www www-data 2656 0.0 0.1 473276 7104 ? S 10:35 0:00 php-fpm: pool www
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With