0

Trying to get monit working for PHP7 but getting a connection error. Here is the config file:

check process php7.0-fpm with pidfile /run/php/php7.0-fpm.pid
group phpcgi
start program = "/usr/sbin/service php7.0-fpm start"
stop program = "/usr/sbin/service php7.0-fpm stop"
if failed unixsocket /run/php/php7.0-fpm.sock then restart
if 3 restarts within 5 cycles then timeout

Anybody have any ideas? I tried changing the pid file location to: /var/run/php/php7.0-fpm.pid but that didn't seem to do the job. I also tested that the start and stop commands work and they do. Also I tried changing the group to www-data but that didn't do it either.

primetimejas
  • 231
  • 2
  • 5

2 Answers2

1

Check if /run/php/php7.0-fpm.sock exists, it doesn't for me.

What worked (assuming php7.0-fpm is listening to port 9000):

# Php7.0-fpm

check process php7.0-fpm with pidfile /run/php/php7.0-fpm.pid
  stop program = "/usr/sbin/service php7.0-fpm stop"
  start program = "/usr/sbin/service php7.0-fpm start"
  if failed port 9000 type TCP then restart
  if 3 restarts within 5 cycles then alert
0

The process name is wrong, it should be php-fpm not php7.0-fpm like:

check process php-fpm with pidfile /run/php/php7.0-fpm.pid
group phpcgi
start program = "/usr/sbin/service php7.0-fpm start"
stop program = "/usr/sbin/service php7.0-fpm stop"
if failed unixsocket /run/php/php7.0-fpm.sock then restart
if 3 restarts within 5 cycles then timeout