7

I'm having a very difficult case with latest php5-fpm (from debphp) and nginx 1.4.3 on Ubtuntu 12.04LTS.

In short, I cannot start php5-fp at all, I keep getting this error in syslog:

kernel: [1213013.564441] init: php5-fpm main process (7357) terminated with status 78
kernel: [1213013.564496] init: php5-fpm main process ended, respawning
..... (repeated several times)
kernel: [1213014.143911] init: php5-fpm respawning too fast, stopped

My /var/log/php5-fpm.log is not populated at all. There is no php5-fpm.sock and php5-fpm.pid in /run (or /var/run).

My /etc/php5/fpm/php-fpm.conf is below: (this file doesn't seem to be loaded now as I tried to put some bogus info into it but didn't cause any change)

;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

include=/etc/php5/fpm/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = /run/php5-fpm.pid
catch_workers_output = yes


; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
log_level = debug

; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
include=/etc/php5/fpm/pool.d/*.conf
include=/var/www/vhosts/mysite.com/w/w/w/www/config/fpm-pool.conf

Permission checking:

ls -l /etc/php5/fpm/php-fpm.conf

-rwxrwxrwx 1 root root 4641 Nov  6 01:37 /etc/php5/fpm/php-fpm.conf

My include=/var/www/vhosts/mysite.com/w/w/w/www/config/fpm-pool.conf (this file does not seem to be loaded anymore)

[www.mysite.com]
    listen                 = /run/php5-fpm.sock
#    listen                = 127.0.0.1:9000
    listen.backlog         = -1
    listen.allowed_clients = 127.0.0.1
    listen.owner           = www.mysite.com
    listen.group           = mysite.com
    listen.mode            = 0666

    user  = www.mysite.com
    group = mysite.com

    pm                   = dynamic
    pm.max_requests      = 0
    pm.max_children      = 15
    pm.start_servers     = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3

    pm.status_path       = /php_pool_wwww.mysite.com_status
    ping.path            = /www.mysite.com_ping
    ping.response        = www.mysite.com_pong

    request_terminate_timeout = 30
    request_slowlog_timeout   = 20
    slowlog                   = /var/www/vhosts/mysite.com/w/w/w/www/logs/php-slow.log

    rlimit_files = 131072
    rlimit_core = unlimited

     chroot = /var/www/vhosts/mysite.com/w/w/w/www/
    ; Chdir to this directory at the start. This value must be an absolute path.
    ; Default Value: current directory or / when chroot
    ; chdir = /htdocs

    catch_workers_output = yes

    env[HOSTNAME] = $HOSTNAME
    env[TMP]      = /tmp
    env[TMPDIR]   = /tmp
    env[TEMP]     = /tmp

    security.limit_extension = .php
    ;   php_value/php_flag             - you can set classic ini defines which can
    ;                                    be overwritten from PHP call 'ini_set'.
    ;   php_admin_value/php_admin_flag - these directives won't be overwritten by
    ;                                     PHP call 'ini_set'
    php_flag[display_errors]            = on
    php_admin_value[error_log]          = /logs/php_err.log
    php_admin_flag[log_errors]          = on
    php_admin_value[memory_limit]       = 100M
    php_value[max_execution_time]       = 300

Permission checking:

ls -l /var/www/vhosts/mysite.com/w/w/w/www/config/fpm-pool.conf

-rwxr-xr-x 1 www.mysite.com mysite.com 1830 Nov  6 01:05 var/www/vhosts/mysite.com/w/w/w/www/config/fpm-pool.conf

User/Group Permission checking:

groups www.mysite.com

www.mysite.com : www.mysite.com www-data mysite.com

I don't think this has anything to do with nginx because php5-fpm itself cannot start at all right now anyhow, but for the sake of having all info: nginx is also set to use same user/group

  • Try to set loglevel to debug in /etc/php5/fpm/php-fpm.conf. That should give you some clues in the error log (path in error_log variable in the same config file). This helped me. The problem on my setup, was that there were conflicting values in the pm.* variables in /etc/php5/fpm/pool.d/www.conf. The only symptom was the exact same as you describe in your question. – Frank Aug 28 '14 at 11:44
  • I got this when I made a typo in my listen directive path. Double-check that the directory you give for your listen directive exists if listening on a unix socket. – user301752 Jul 28 '15 at 7:05
  • For future readers, the permissions on the config files have nothing to do with this; they only need to be readable to the user a service runs under. You definitely don't need them executable nor world-writeable. – Walf Jun 5 '17 at 23:33
9

The process that upstart was watching died, but the pool workers are still running. To fix it, run:

sudo killall php-fpm
sudo start php5-fpm

The php5-fpm job will repeatedly exit with status 78 until all of the old worker threads are dead. Note that the server is typically functional in this state, even though upstart isn't managing the service. When it eventually dies, though, it won't automatically respawn, so it should be fixed ASAP. A simple reboot will also fix the problem, but will result in downtime.

  • 1
    killall gave me a php-fpm: no process found response. I executed ps aux | grep php and then manually killed all php processes. After that I could successfully restart php5-fpm service. – aldo.roman.nurena Oct 12 '15 at 19:23
  • Didn't work for me. There are no php-fpm processes running according to ps aux. – Jake Wilson Jun 1 '17 at 17:14
  • @Jake Wilson Did you check to see if it's under a different name? Try grepping for php or fpm instead of php-fpm. Some distros put the version number in the middle. – Zenexer Jun 1 '17 at 17:48
  • Ya for me it's php5.6-fpm. Still not seeing it. syslog is showing it crashing with an error 78 whenever I try to start it. Still trying to sort this out. – Jake Wilson Jun 2 '17 at 3:29
  • Check to see if there's an old .sock file for FPM in /var/run/. If the sock file would normally be created in a subdirectory, make sure it exists and has appropriate permissions (777 is never appropriate). Also, make sure it's not a basic problem, such as an invalid config; I believe you can check the config with sudo php-fpm -t – Zenexer Jun 2 '17 at 4:05
0

I recently encountered this same issue. It turns out that another process was already listening on the same port. To discover which process was running, I ran the following command:

sudo netstat -nltp

Turns out that hhvm was already listening on port 9000.

tcp6       0      0 :::9000                 :::*                    LISTEN      17765/hhvm      

As soon as I stopped the hhvm daemon, php5-fpm successfully started.

  • Now that I take a closer look at the fpm-pool.conf posted in the question, php5-fpm was not configured to listen on a port, but to use a sock. However, I'll keep this answer here in case anyone else encounters the same problem I ran into. – Jimmy Z Mar 12 '15 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.