Opened 10 years ago

Closed 10 years ago

#5474 closed enhancement (fixed)

php-fpm.service

Reported by: christopher Owned by:
Priority: normal Milestone: 7.6
Component: systemd Version: SVN
Severity: normal Keywords:
Cc:

Description

Hello,

When using the current php-fpm.service file from the blfs-systemd-unit files this service fails to start.

Research shows that as of February this year that Debian has a bug report open with the same issue at:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737825

Although there also appears to be another bug with their version, the timeout for the service start is valid.

If you scroll to almost the bottom you will see a comment that they think that the issue is with the Type=notify being set in the unit file. They have almost an identical unit file to the one we are currently providing.

Seeing this hint at what the problem may be led me to make changes to my uint file as follows:

[Service] Type=forking PIDFile=/run/php-fpm.pid PrivateTmp=true ExecStart=/usr/sbin/php-fpm --daemonize --allow-to-run-as-root --fpm-config /etc/php-fpm.conf --pid /run/php-fpm.pid ExecReload=/bin/kill -USR2 $MAINPID

By using this in the unit file the service starts and remains running.

I tested various changes to that by leaving it as --nodaemonize with Type set to forking and it failed. Also it failed with --nodaemonize with type set to forking.

The --allow-to-run-as-root is needed for the main php-fpm master process. This is turned off by default in the --fpm-config file. With the master php-fpm process running as root, the child processes are run as user/group apache.

It would be nice if someone else is also able to confirm this. It has taken me a good while to track down this.

Research has also shown that other distributions back as early as 2011 had the Type=forking set in their unit files for this, though things do change over the years with different versions of systemd and the like.

Regards,

Christopher.

Change History (1)

comment:1 by christopher, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.