Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 439918 - app-admin/eselect-php[fpm]: add systemd unit
Summary: app-admin/eselect-php[fpm]: add systemd unit
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords: NeedPatch
: 474548 479816 (view as bug list)
Depends on:
Blocks: install-systemd-unit 480030 488540
  Show dependency tree
 
Reported: 2012-10-27 20:01 UTC by Mathieu Rochette
Modified: 2014-05-13 12:54 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Rochette 2012-10-27 20:01:03 UTC
dev-lang/php[fpm] provide /etc/init.d/php-fpm but there is no service file for systemd

Reproducible: Always
Comment 1 Ole Markus With (RETIRED) gentoo-dev 2013-05-25 09:23:46 UTC
php-5.5.0_rc2 has --with-fpm-systemd, which I plan on adding support for under the systemd USE flag.

What is the cleanest way of handling the unit file?

I am thinking that it must be in the eselect-php package so it can handle multiple slots. But that means a systemd USE flag there as well since eselect-php should only be aware of fpm-installs with systemd support.

Does anyone have any other alternatives?
Comment 2 Ole Markus With (RETIRED) gentoo-dev 2013-07-15 09:54:04 UTC
*** Bug 474548 has been marked as a duplicate of this bug. ***
Comment 3 Ole Markus With (RETIRED) gentoo-dev 2013-07-27 11:18:43 UTC
I added preliminary support for systemd now, but it is not as good as I would like it to be. Most notably, it does not respect what you set as default fpm verion, you have to explicitly set it as the service's instance name.
Comment 4 Ole Markus With (RETIRED) gentoo-dev 2013-08-06 12:49:14 UTC
*** Bug 479816 has been marked as a duplicate of this bug. ***
Comment 5 Thomas Scheiblauer 2013-11-22 16:25:09 UTC
Systemd support was included in the php-5.5.3-r1.ebuild but was removed again in the more recent ebuilds without a notice in the Changelog. Maybe they just took an older ebuild as template for the newer ones.
The problem is that the included systemd unit which gets still installed despite the now missing systemd useflag sets the service type to "notify" which makes php-fpm startup hang until timeout and gets it killed afterwards because without compiled in systemd support using "--with-fpm-systemd" php-fpm will not send the startup notification to systemd's notification socket.
So please either readd systemd support to php or set the systemd service type to "forking".
Comment 6 Ole Markus With (RETIRED) gentoo-dev 2013-11-22 16:28:21 UTC
(In reply to Thomas Scheiblauer from comment #5)
> Systemd support was included in the php-5.5.3-r1.ebuild but was removed
> again in the more recent ebuilds without a notice in the Changelog. Maybe
> they just took an older ebuild as template for the newer ones.
> The problem is that the included systemd unit which gets still installed
> despite the now missing systemd useflag sets the service type to "notify"
> which makes php-fpm startup hang until timeout and gets it killed afterwards
> because without compiled in systemd support using "--with-fpm-systemd"
> php-fpm will not send the startup notification to systemd's notification
> socket.
> So please either readd systemd support to php or set the systemd service
> type to "forking".

Systemd "support" only existed for ~arch, so it is not something that is very urgent for us to fix right now.
Comment 7 Thomas Scheiblauer 2013-11-22 16:40:22 UTC
It's not for me, I added systemd support back by myself in my local overlay. But you could at least set the Type property in the systemd unit "php-fpm@.service" file set to "forking", which is an easy fix, to not leave the systemd "~arch" people with an obviously broken ebuild.
Btw, sys-apps/systemd-204-r1 and dev-lang/php-5.5.4 are already in "arch" so also the stable systemd users would run into this problem, at least when the use nginx with php-fpm.
Comment 8 Ole Markus With (RETIRED) gentoo-dev 2013-11-22 17:05:31 UTC
(In reply to Thomas Scheiblauer from comment #7)
> It's not for me, I added systemd support back by myself in my local overlay.
> But you could at least set the Type property in the systemd unit
> "php-fpm@.service" file set to "forking", which is an easy fix, to not leave
> the systemd "~arch" people with an obviously broken ebuild.
> Btw, sys-apps/systemd-204-r1 and dev-lang/php-5.5.4 are already in "arch" so
> also the stable systemd users would run into this problem, at least when the
> use nginx with php-fpm.

If you use systemd, you cannot use any current version of PHP. None of our versions support systemd even if unstable eselect-php ships a unit file.
Comment 9 Thomas Scheiblauer 2013-11-22 18:13:34 UTC
I've readded the systemd support to php-5.5.6 (just copied a few lines from php-5.5.3-r1) and it works superbly with systemd.service type "notify" as used in eselect-php's systemd unit file. In essence it's nothing more than adding "--with-fpm-systemd" to the configure options.
Comment 10 Steffen Weber 2013-11-22 20:51:33 UTC
I'm using systemd and the same patch has been working fine for me with PHP 5.4.x in the last 3-4 months (see attachment of bug #479816). I don't understand why it has been removed. Is there any problem with the patch?
Comment 11 Pacho Ramos gentoo-dev 2014-01-10 23:15:00 UTC
(In reply to Ole Markus With from comment #1)
> php-5.5.0_rc2 has --with-fpm-systemd, which I plan on adding support for
> under the systemd USE flag.
> 
> What is the cleanest way of handling the unit file?
> 
> I am thinking that it must be in the eselect-php package so it can handle
> multiple slots. But that means a systemd USE flag there as well since
> eselect-php should only be aware of fpm-installs with systemd support.
> 
> Does anyone have any other alternatives?

Why not simply make each dev-lang/php slot provide a php-${SLOT}.service file? (without relying in eselect)
Comment 12 Mike Gilbert gentoo-dev 2014-01-10 23:17:03 UTC
As a member of the systemd team and a light user of php:

I think eselect-php is the wrong place for this.

I would instead install php-fpm-${SLOT}.service in the dev-lang/php ebuild.

Also, the service unit should not contain Type=notify if the systemd use flag is disabled on dev-lang/php. There are 2 alternate solutions:

1. Change Type=notify to Type=simple if USE=systemd is disabled.
2. Don't install the unit file if USE=systemd is disabled.
Comment 13 Pacho Ramos gentoo-dev 2014-01-10 23:19:06 UTC
In bug 488540 also okias suggests to use "--nodaemonize" that will let to drop all the PID handling and would be preferred too
Comment 14 David Heidelberg (okias) 2014-01-12 13:44:25 UTC
Anyway, in this moment this isn't enhancement, but major _fuckup_, because when you install PHP, you'll be not able run php-fpm@5.5 in ANY condition WITHOUT modifying service.

It's big waste of time for people using systemd (OFFICIALY supported by upstream, disabled by gentoo and replaced by non-working file) and solution is already found.

Where is problem fixing this issue?
Comment 15 Ole Markus With (RETIRED) gentoo-dev 2014-01-13 09:23:56 UTC
In general: no stable ebuild of php had systemd support, so pulling systemd support from php is not a regression of any sort. I can delete the eselect-php versions shipping the unit files if this is such a big problem.

For now, I have no plans on working more with systemd. It is a significantly higher priority to prepare the tree for php 5.6, which is entering testing soon.
Comment 16 Pacho Ramos gentoo-dev 2014-01-15 06:59:52 UTC
We (systemd team) could work on the unit files for php if needed, but, as explained, we would opt by the units being provided by php ebuilds and different for each slot. What do you think?
Comment 17 Ole Markus With (RETIRED) gentoo-dev 2014-01-15 13:29:27 UTC
(In reply to Pacho Ramos from comment #16)
> We (systemd team) could work on the unit files for php if needed, but, as
> explained, we would opt by the units being provided by php ebuilds and
> different for each slot. What do you think?

That is absolutely fine by me :)
Comment 18 Pacho Ramos gentoo-dev 2014-02-02 21:10:02 UTC
All reworked in latest revisions
Comment 19 Kfir Ozer 2014-05-13 12:54:22 UTC
i patched php 5.5.12 with php-5.5.11-systemd.patch and it works fine.
don't use fpm so donno about that.

thanks!