Topic: PHP-FPM 5.6 Fails to start after reboot on CentOS 7

Hi

I noticed today that PHP-FPM 5.6 packages fail to startup after a reboot on CentOS 7 because the /run/php-fpm directory does not exist.
Checking the service file in /usr/lib/systemd/system/php-fpm.service I can see that RuntimeDirectory is missing. This statement exists in the PHP-FPM 7.2 packages but not the 5.6 packages. It means after a reboot, because /run is tmpfs, the php-fpm subfolder does not exist and the service fails to start.

Here is the 5.6 service file:

# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades.  If you want to customize,
# the best way is to use the "systemctl edit" command.

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/php-fpm
ExecStart=/usr/sbin/php-fpm --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

The PHP-FPM 7 service file is this and this one works after reboot:

# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades.  If you want to customize,
# the best way is to use the "systemctl edit" command.

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/php-fpm
ExecStart=/usr/sbin/php-fpm --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
RuntimeDirectory=php-fpm
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target

Is this something that would be able to be fixed in an updated package? No specific rush as we can work around it for now. smile

Thanks!

Re: PHP-FPM 5.6 Fails to start after reboot on CentOS 7

Just to note - we are migrating everything slowly to 7.1 and 7.2 and almost there.
But it would be great to know the 5.6 packages work nicely in case we need any rollbacks etc.

Re: PHP-FPM 5.6 Fails to start after reboot on CentOS 7

Indeed, this change was only applied to PHP 7.0+

But older versions have /usr/lib/tmpfiles.d/php-fpm.conf which should take care of its creation on reboot.

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: PHP-FPM 5.6 Fails to start after reboot on CentOS 7

Just checked on a fresh install, works for me

# systemctl enable --now php-fpm
# init 6
...
# ll /run/php-fpm/
total 4
-rw-r--r--. 1 root root 4 14 févr. 10:27 php-fpm.pid
# rpm -qf /run/php-fpm/
php-fpm-5.6.40-1.el7.remi.x86_64

Sorry, but cannot reproduce

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: PHP-FPM 5.6 Fails to start after reboot on CentOS 7

Yes I just discovered this.

I just found that the tmp files service failed - so it didn't create the folder.

Sorry for the false alarm!

Here's from my journalctl:
Breaking ordering cycle by deleting job systemd-tmpfiles-setup.service/start

Looks like known issue with RedHat/CentOS and network file systems. They cause a circular dependency and it seems it most often starts deleting services to break it. Doh!

Thanks for the fast response - I was hoping I'd post this before you saw it to save you some time! Again, apologies, and thank you.