PHP-FPM does not automatically start after reboot

Solution 1:

So set it up to start at boot:

chkconfig php-fpm on

Solution 2:

I just ran into this very problem on Ubuntu 16.04 and I'm leaving my answer here for future users from Google who stumble onto the problem. Since chkconfig is mostly specific to CentOS, it obviously doesn't exist on Ubuntu. Apparently, to get a custom-built PHP (php-fpm SAPI) to start at boot under systemd, which is new to Ubuntu 16.04 (previously, Upstart), it needs to be registered with the system beyond just dropping the init.d script into /etc/init.d/. To register the script, I ran:

update-rc.d php-fpm defaults

A reboot and subsequent ps aux confirmed that php-fpm was indeed starting at boot. It was also added to /etc/init.d/.depend.start.

Other thoughts: Ubuntu Upstart was nice enough so that I never had to run update-rc.d after placing an init.d script - it just worked. Completely forgot about that command.


Solution 3:

Since CentOS 7 you simply need to enable the services via systemctl:

systemctl enable php-fpm

You can check if it's running afterwards via:

systemctl status php-fpm