Ubuntu php5-fpm throws unknown instance on reload

前端 未结 9 822
忘了有多久
忘了有多久 2020-12-24 06:28

I am having some problems with ubuntu and php5-fpm on my VPS. Php works fine, however it throws terminal error when I am trying to reload / restart / stop it. Basically, I c

相关标签:
9条回答
  • 2020-12-24 06:56

    Seems like the service command sometimes fails. I don't know about the reason, however I ended up using this workaround in /etc/logrotate.d/php5-fpm:

    /var/log/php5-fpm.log {
        ...
        postrotate
            # The original reload command did never work
            #invoke-rc.d php5-fpm reopen-logs > /dev/null
    
            # Workaround for cases when the reload command fails for some reason
            service php5-fpm reload > /dev/null 2>&1
            [ $? = 0 ] || ( service php5-fpm stop; pkill php5-fpm; service php5-fpm start ) > /dev/null
        endscript
    }
    
    0 讨论(0)
  • 2020-12-24 07:04

    The option that worked for me was to reset opcache. Create a file opcache-reset.php file in your site root and add:

    <?php opcache_reset(); ?>
    

    After reseting opcache, you can delete the file or move it out of your site root.

    0 讨论(0)
  • 2020-12-24 07:05

    Deploying with Envoyer brought me here. I ended up adding a 'before' deployment hook to the Activate New Release action with the pkill php5-fpm process

    0 讨论(0)
  • 2020-12-24 07:06

    Usually, the service command will do fine:

    service php5-fpm restart
    

    But if the "unknown instance" issue appears, you can just kill the processes and have the service restarted, using this line:

    sudo pkill php5-fpm; sudo service php5-fpm start
    
    0 讨论(0)
  • 2020-12-24 07:08

    Try to stop your php5-fpm instance by service php5-fpm stop again. Wait for some seconds. Try to see, which processes was not terminated using ps -ef. Terminate them by kill <processId>. Start php5-fpm again. Is seems, not all child processes was terminated properly by service ... command. I have similar issues in on server, but they are not regular

    0 讨论(0)
  • 2020-12-24 07:10

    I have experienced the same issue using Envoyer for Laravel - and that was quite annoying. My solution was to follow option 3) at https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242376/comments/16

    Create /etc/init/php5-fpm.override file with the single line "reload signal USR2" in it.

    0 讨论(0)
提交回复
热议问题