Results 1 to 10 of 10

Thread: PHP-FPM 5.6 and 7.0 error restart every minute

  1. #1
    Join Date
    Mar 2015
    Posts
    9

    PHP-FPM 5.6 and 7.0 error restart every minute

    Hi,

    I have big problem with php-fpm 5.6 and 7.0 - every minute php-fpm is restarted and mostly not started, after 15-20 seconds work again, but after next restart again failed.

    System Debian 8.

    I have second one server - this same hardware and software configuration, and everything work properly. This one is a new server - about 15 users. After rebuild them to fastcgi all works, but I want php-fpm...

    Any idea?


    daemon.log:
    Code:
    Apr 17 00:45:06 hs2 systemd[1]: php-fpm56.service start operation timed out. Terminating.
    Apr 17 00:45:06 hs2 systemd[1]: Failed to start The PHP FastCGI Process Manager.
    Apr 17 00:45:06 hs2 systemd[1]: Unit php-fpm56.service entered failed state.
    Apr 17 00:45:32 hs2 systemd[1]: php-fpm70.service start operation timed out. Terminating.
    Apr 17 00:45:32 hs2 systemd[1]: Failed to start The PHP FastCGI Process Manager.
    Apr 17 00:45:32 hs2 systemd[1]: Unit php-fpm70.service entered failed state.
    Apr 17 00:45:37 hs2 systemd[1]: Starting The PHP FastCGI Process Manager...
    php-fpm70.log
    Code:
    [17-Apr-2017 00:41:36] NOTICE: fpm is running, pid 4750
    [17-Apr-2017 00:41:36] NOTICE: ready to handle connections
    [17-Apr-2017 00:43:06] NOTICE: Terminating ...
    [17-Apr-2017 00:43:06] NOTICE: exiting, bye-bye!
    [17-Apr-2017 00:44:01] NOTICE: fpm is running, pid 4847
    [17-Apr-2017 00:44:01] NOTICE: ready to handle connections
    [17-Apr-2017 00:45:32] NOTICE: Terminating ...
    [17-Apr-2017 00:45:32] NOTICE: exiting, bye-bye!
    journalctl -xn
    Code:
    -- Logs begin at pon 2017-04-17 00:29:24 CEST, end at pon 2017-04-17 00:59:53 CEST. --
    kwi 17 00:59:31 hs2.linux.pl systemd[1]: php-fpm56.service start operation timed out. Terminating.
    kwi 17 00:59:31 hs2.linux.pl systemd[1]: Failed to start The PHP FastCGI Process Manager.
    -- Subject: Unit php-fpm56.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit php-fpm56.service has failed.
    -- 
    -- The result is failed.
    kwi 17 00:59:31 hs2.linux.pl systemd[1]: Unit php-fpm56.service entered failed state.
    kwi 17 00:59:36 hs2.linux.pl systemd[1]: Starting The PHP FastCGI Process Manager...
    -- Subject: Unit php-fpm56.service has begun with start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit php-fpm56.service has begun starting up.
    kwi 17 00:59:48 hs2.linux.pl lfd[2008]: SYSLOG check [wDTY71znS56JJlyb4RVJXG3CEfSs]
    kwi 17 00:59:53 hs2.linux.pl clamd[1329]: SelfCheck: Database status OK.
    Last edited by linuxpl; 04-17-2017 at 12:48 PM.

  2. #2
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,672
    Hello,

    You need to identify a reason on why PHP-FPM fails to start properly. The logs you posted does not give a clue at least to me.

    You'd better read entire /var/log/messages directly without using 'journalctl -xn'.
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  3. #3
    Join Date
    Mar 2015
    Posts
    9
    I think this may be systemd related.

    I changed entry Type=notify to Type=simple in file /etc/systemd/system/php-fpm70.service, and php-fpm70 now work without timeouts and restarts.

    php-fpm56 work at this moment without this change, but this is copy which I made before last compiling.

    But still I don't know why this work on another two servers (after last update php7.0 too).

    /var/log/messages has no any entry related, there are some about segfaults php 5.6:

    Apr 17 16:39:27 hs2 kernel: [58114.901479] php-fpm56[11337]: segfault at 2af889800 ip 00000000007d96fb sp 00007ffc4cfdc210 error 4 in php-fpm56[400000+a9a000]
    Apr 17 16:39:28 hs2 kernel: [58115.919405] php-fpm56[11340]: segfault at ffffffff ip 00000000007d96fb sp 00007ffc4cfdc210 error 4 in php-fpm56[400000+a9a000]
    Apr 17 16:39:30 hs2 kernel: [58118.436618] traps: php-fpm56[11341] general protection ip:7d9ac9 sp:7ffc4cfdc210 error:0 in php-fpm56[400000+a9a000]

  4. #4
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,672
    Shooting in a dark...

    do you see any error or warning when you run in root console:

    Code:
    /usr/local/php56/bin/php -v
    Code:
    /usr/local/php70/bin/php -v
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  5. #5
    Join Date
    Mar 2015
    Posts
    9
    No error messages.

    Now I know this is not a php problem - php scripts works normal when php is in start state:
    Code:
    ● php-fpm70.service - The PHP FastCGI Process Manager
       Loaded: loaded (/etc/systemd/system/php-fpm70.service; enabled)
       Active: activating (start) since pon 2017-04-17 21:21:01 CEST; 1s ago
     Main PID: 29289 (php-fpm70)
       CGroup: /system.slice/php-fpm70.service
               └─29289 php-fpm: master process (/usr/local/php70/etc/php-fpm.conf)
    but after about one minute php entered failed state (and php scripts stop works - error 500):
    Code:
    ● php-fpm70.service - The PHP FastCGI Process Manager
       Loaded: loaded (/etc/systemd/system/php-fpm70.service; enabled)
       Active: failed (Result: timeout) since pon 2017-04-17 21:20:06 CEST; 53s ago
      Process: 29110 ExecStart=/usr/local/php70/sbin/php-fpm70 --nodaemonize (code=exited, status=0/SUCCESS)
     Main PID: 29110 (code=exited, status=0/SUCCESS)
    
    kwi 17 21:20:06 hs2.linux.pl systemd[1]: php-fpm70.service start operation timed out. Terminating.
    kwi 17 21:20:06 hs2.linux.pl systemd[1]: Failed to start The PHP FastCGI Process Manager.
    kwi 17 21:20:06 hs2.linux.pl systemd[1]: Unit php-fpm70.service entered failed state.
    I have no idea how I can diagnose more. At this time one solution for me is change Type to simple in systemd script. After this php start fast and no errors:
    Code:
    ● php-fpm70.service - The PHP FastCGI Process Manager
       Loaded: loaded (/etc/systemd/system/php-fpm70.service; enabled)
       Active: active (running) since pon 2017-04-17 21:22:29 CEST; 24s ago
     Main PID: 29383 (php-fpm70)
       CGroup: /system.slice/php-fpm70.service
               └─29383 php-fpm: master process (/usr/local/php70/etc/php-fpm.conf)
    
    kwi 17 21:22:29 hs2.linux.pl systemd[1]: Started The PHP FastCGI Process Manager.

  6. #6
    Join Date
    May 2014
    Location
    Netherlands Germany
    Posts
    320
    All Updated and Custombuild?

    We had this for a about a year ago,

    Then deinstalled the php 7 didn't solve the problem, placing back image and again installing php 7 problem came back, so we don't use the php 7 after that, at that time more probs.

    No errors was the main problem.

    PHP script don't working well if restarts, not every php programm or cms likes this. !


    Problem her is/was in testing everything went good, then live there was a update wich we didn.t find out the problem starts, so while not having php 7 is here on that server not bad, we don't try to install php7 AGAIN while LIVE BOX.

    CENTOS 7 PHP7 and PHP 5.6 both FPM Apache 2.4 at that time Suhossin was maybe the problem interfering while no php7 support at that time i thought as maybe the cause of this! ( also ioncube, HTTP/2 and zend installed)


    So thats why i ask is all updated?

    I mean all updated before putting / enable second version of PHP on the BOX

    Problem was also after updates everything seems to work, but at a time after rebooting BOX this was then the error, so problem was here unoticed for a while, so debugging for real error or which update was not succesfull!

    So take care of your other 2 boxes that they still work well if you reboot them? ( and or rewrite confs)

    Sorry my reply is not helping you, while i only pointing out is All Updated , to reboot boxes and rewrite confs to check on other boxes to.
    Last edited by ikkeben; 04-18-2017 at 03:29 AM.
    DUTCH GERMAN, GERMAN DUTCH

  7. #7
    Join Date
    Mar 2015
    Posts
    9
    I think problem is solved.
    The problem is that the php-fpm process doesn't return a signal to systemd when it's starting, so systemd thinks it didn't start properly and kills the process and restart them.

    I addeed --with-fpm-systemd option to php70 compilation and now php-fpm70 works with Type=notify in /etc/systemd/system/php-fpm70.service!
    Last edited by linuxpl; 04-18-2017 at 02:57 PM.

  8. #8
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,672
    Are you sure that you have the latest custombuild script and directadmin? It's custombuild which should care of it, I see this:

    Code:
                    if ! grep -c 'with-fpm-systemd' ${CONF_FILE}; then
                            perl -pi -e 's#--enable-fpm \\#--enable-fpm \\\n\t--with-fpm-systemd \\#' ${CONF_FILE}
                    fi
    Or you have a custom versions of configure.php70 ?
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

  9. #9
    Join Date
    Mar 2015
    Posts
    9
    Hmm... I'm sure that I have latest DA and custombuild, this server was intalled 2 months ago and all software is updated.
    I see this entry in build script too, and I have custom version of configure, but diff with default is only "--enable-exif" \ - this same config work on 2 more servers.

    Will try remove --with-fpm-systemd from config and build php70 again. Let's see if this works...

  10. #10
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    11,672
    Just solved the same issue on a server of my client with PHP-FPM 7.1

    In my case the client had a custom /usr/local/directadmin/custombuild/custom/fpm/configure.php71 with double quotes, i.e.

    Code:
            "--program-suffix=71" \
            "--enable-fpm" \
    hence the patch in the build script did not work. Everything went fine after removing double-quotes and running:

    Code:
    ./build php
    With regards, Alex.

    Professional Server Management for web hosting companies and individuals
    Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
    Directadmin installation and optimization

    Click here if you need a Linux Admin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •