0

on my server (FreeBSD 11) the php-fpm service is not srating cleanly anymore.

# service php-fpm status
php_fpm is not running.

but if i search for running instances i see its working (in fact the web application also uses it and is working:

# top | grep php-fpm
572 root          1  20    0   265M  4688K kqread  0   3:58   0.00% php-fpm
50875 www           1  31    0   273M 22188K accept  1   0:12   0.00% php-fpm
50872 www           1  20    0   271M 20816K accept  1   0:10   0.00% php-fpm
51438 www           1  30    0   269M 15024K accept  1   0:05   0.00% php-fpm

and if I kill it and start it by hand its in fact starting but complaining about not beeing able to start (same output on "service php-fpm restart"):

# service php-fpm start
Performing sanity check on php-fpm configuration:
[10-Mar-2017 13:10:54] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/apc.so' - Cannot open "/usr/local/lib/php/20131226/apc.so" in Unknown on line 0
[10-Mar-2017 13:10:54] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful

Starting php_fpm.
[10-Mar-2017 13:10:54] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20131226/apc.so' - Cannot open "/usr/local/lib/php/20131226/apc.so" in Unknown on line 0
[10-Mar-2017 13:10:54] ERROR: An another FPM instance seems to already listen on /var/run/php5-fpm.sock
[10-Mar-2017 13:10:54] ERROR: FPM initialization failed
/usr/local/etc/rc.d/php-fpm: WARNING: failed to start php_fpm

what could produce this?

Hamid Pourjam
  • 20,441
  • 9
  • 58
  • 74
Mr.Gosh
  • 181
  • 2
  • 9
  • The error message "An another FPM instance seems to already listen on" is caused when PHP-FPM successfully connects to the socket file before it's started so it maybe something else has created the socket (perhaps another PHP-FPM is running) – SameOldNick Mar 13 '17 at 15:50
  • 1
    i recognized, that the service is searching for /var/run/php-fpm.pid and not for /var/run/php5-fpm.pid - so i "touched" that file and changed the config - it seems to solve the problem - but could this be caused by a FreeBSD upgrade from 10.3 to 11? – Mr.Gosh Mar 13 '17 at 16:15

1 Answers1

0

Mr.Gosh above gave the correct answer. The issue is pid file which probably doesn't have declared path/filename in php-fpm.conf like this:

include=etc/php-fpm.d/*.conf

[global]
pid = run/php-fpm.pid
events.mechanism = kqueue
error_log = /home/user/logs/php-error.log
dzhi
  • 1,534
  • 2
  • 18
  • 29