0

Monit is correctly detecting that php5-fpm is unavailable as seen in the logs. However, it does not seem to be able to restart the service.

log:

[EDT Jun 11 18:04:20] error    : 'php5-fpm' failed, cannot open a connection to UNIX[/var/run/php5-fpm.sock]                                                   
[EDT Jun 11 18:04:20] info     : 'php5-fpm' trying to restart                                                                                                  
[EDT Jun 11 18:04:20] info     : 'php5-fpm' stop: /etc/init.d/php5-fpm                                                                                         
[EDT Jun 11 18:04:50] error    : 'php5-fpm' failed to stop  

and here is the configuration for monit

check process php5-fpm with pidfile /var/run/php5-fpm.pid                                                                                                      
  group php #change accordingly                                                                                                                                
  start program = "/etc/init.d/php5-fpm start"                                                                                                                 
  stop program = "/etc/init.d/php5-fpm stop"                                                                                                                   
  if failed unixsocket /var/run/php5-fpm.sock then restart   

manually restarting php5-fpm with "service php5-fpm restart" clears this error until it happens again.

The server is ubuntu 14.04. PHP 5.6.9

6
  • Ubuntu 14.04 uses php 5.5.9. Where did you grab 5.6.9 from? Jun 12, 2015 at 16:14
  • Also, can you show us what you get after running: # /etc/init.d/php5-fpm stop; echo $? Jun 12, 2015 at 16:21
  • 5.6.9 came from here: digitalocean.com/community/questions/…
    – Kevin
    Jun 12, 2015 at 16:47
  • running /etc/init.d/php5-fpm stop or start returns nothing. I tested with another service (elasticsearch) and it worked fine. So it's php5-fpm I guess.
    – Kevin
    Jun 12, 2015 at 16:50
  • I've just installed php5-fpm and monit on 14.04 in Docker, and with your script this works fine. What kind of customizations did you do to monit or php-fpm config files? Jun 12, 2015 at 17:04

1 Answer 1

0

I did spin up docker container with Ubuntu 14.04, monit and php5-fpm from 'ondrey' PPA.

This is what I get after I remove the fpm socket:

[UTC Jun 12 17:03:06] error    : 'php5-fpm' failed, cannot open a connection to UNIX[/var/run/php5-fpm.sock]
[UTC Jun 12 17:03:06] info     : 'php5-fpm' trying to restart
[UTC Jun 12 17:03:06] info     : 'php5-fpm' stop: /etc/init.d/php5-fpm
[UTC Jun 12 17:03:06] info     : 'php5-fpm' start: /etc/init.d/php5-fpm
[UTC Jun 12 17:03:26] info     : 'php5-fpm' connection succeeded to UNIX[/var/run/php5-fpm.sock]

It seems that /etc/init.d/php5-fpm stop is failing in your case, and looking at script the only way it can fail is if the processes are running but the script fails to stop them. Return code is 2 then.

Since ubuntu already had issues with upstart vs sysvinit, like in this case: https://stackoverflow.com/questions/23464157/cant-start-or-stop-php-fpm-on-ubuntu

I would advise you to change your monit config for php5-fpm to:

check process php5-fpm with pidfile /var/run/php5-fpm.pid
    group php
    start program = "/usr/sbin/service php5-fpm start"
    stop program = "/usr/sbin/service php5-fpm stop"
    if failed unixsocket /var/run/php5-fpm.sock then restart

and see if that helps.

0

You must log in to answer this question.

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