diff options
author | Emil Kronborg <emil.kronborg@protonmail.com> | 2024-01-31 19:13:13 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-01-31 14:18:31 -0800 |
commit | 4cefe0196f7a2471b144413510d072d525e1a041 (patch) | |
tree | e29460d618dbb405eb0e99782bce7ce1f0c341bf /meta-oe | |
parent | 0ffbe2a79a5d49b2719c934ca0e73822fa3cbc2e (diff) | |
download | meta-openembedded-4cefe0196f7a2471b144413510d072d525e1a041.tar.gz |
php-fpm: fix systemd
2848cc99a186 ("php-fpm: Add support for systemd") introduced a systemd
service file, where ExecStart and ExecStop uses /etc/init.d/php-fpm,
which does not exist if systemd is enabled. Consequently, the php-fpm
service fails to start even though it is correctly installed. This is
fixed by this commit in which the service file is identical to the one
from the PHP source code except for the use of BitBake variables. Also,
use ${systemd_system_unitdir} instead of ${systemd_unitdir}/system.
Signed-off-by: Emil Kronborg <emil.kronborg@protonmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r-- | meta-oe/recipes-devtools/php/php/php-fpm.service | 57 | ||||
-rw-r--r-- | meta-oe/recipes-devtools/php/php_8.2.9.bb | 17 |
2 files changed, 62 insertions, 12 deletions
diff --git a/meta-oe/recipes-devtools/php/php/php-fpm.service b/meta-oe/recipes-devtools/php/php/php-fpm.service index eec76fb56..918ffe674 100644 --- a/meta-oe/recipes-devtools/php/php/php-fpm.service +++ b/meta-oe/recipes-devtools/php/php/php-fpm.service | |||
@@ -1,10 +1,57 @@ | |||
1 | # It's not recommended to modify this file in-place, because it | ||
2 | # will be overwritten during upgrades. If you want to customize, | ||
3 | # the best way is to use the "systemctl edit" command. | ||
4 | |||
1 | [Unit] | 5 | [Unit] |
2 | Description=PHP-FPM | 6 | Description=The PHP FastCGI Process Manager |
3 | After=network.target | 7 | After=network.target |
8 | |||
4 | [Service] | 9 | [Service] |
5 | Type=forking | 10 | Type=simple |
6 | PIDFile=/run/php-fpm.pid | 11 | PIDFile=@LOCALSTATEDIR@/run/php-fpm.pid |
7 | ExecStart=@SYSCONFDIR@/init.d/php-fpm start | 12 | ExecStart=@SBINDIR@/php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf |
8 | ExecStop=@SYSCONFDIR@/init.d/php-fpm stop | 13 | ExecReload=@BINDIR@/kill -USR2 $MAINPID |
14 | |||
15 | # Set up a new file system namespace and mounts private /tmp and /var/tmp directories | ||
16 | # so this service cannot access the global directories and other processes cannot | ||
17 | # access this service's directories. | ||
18 | PrivateTmp=true | ||
19 | |||
20 | # Mounts the /usr, /boot, and /etc directories read-only for processes invoked by this unit. | ||
21 | ProtectSystem=full | ||
22 | |||
23 | # Sets up a new /dev namespace for the executed processes and only adds API pseudo devices | ||
24 | # such as /dev/null, /dev/zero or /dev/random (as well as the pseudo TTY subsystem) to it, | ||
25 | # but no physical devices such as /dev/sda. | ||
26 | PrivateDevices=true | ||
27 | |||
28 | # Explicit module loading will be denied. This allows to turn off module load and unload | ||
29 | # operations on modular kernels. It is recommended to turn this on for most services that | ||
30 | # do not need special file systems or extra kernel modules to work. | ||
31 | ProtectKernelModules=true | ||
32 | |||
33 | # Kernel variables accessible through /proc/sys, /sys, /proc/sysrq-trigger, /proc/latency_stats, | ||
34 | # /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq will be made read-only to all processes | ||
35 | # of the unit. Usually, tunable kernel variables should only be written at boot-time, with the | ||
36 | # sysctl.d(5) mechanism. Almost no services need to write to these at runtime; it is hence | ||
37 | # recommended to turn this on for most services. | ||
38 | ProtectKernelTunables=true | ||
39 | |||
40 | # The Linux Control Groups (cgroups(7)) hierarchies accessible through /sys/fs/cgroup will be | ||
41 | # made read-only to all processes of the unit. Except for container managers no services should | ||
42 | # require write access to the control groups hierarchies; it is hence recommended to turn this on | ||
43 | # for most services | ||
44 | ProtectControlGroups=true | ||
45 | |||
46 | # Any attempts to enable realtime scheduling in a process of the unit are refused. | ||
47 | RestrictRealtime=true | ||
48 | |||
49 | # Restricts the set of socket address families accessible to the processes of this unit. | ||
50 | # Protects against vulnerabilities such as CVE-2016-8655 | ||
51 | RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX | ||
52 | |||
53 | # Takes away the ability to create or manage any kind of namespace | ||
54 | RestrictNamespaces=true | ||
55 | |||
9 | [Install] | 56 | [Install] |
10 | WantedBy=multi-user.target | 57 | WantedBy=multi-user.target |
diff --git a/meta-oe/recipes-devtools/php/php_8.2.9.bb b/meta-oe/recipes-devtools/php/php_8.2.9.bb index cb9d0060a..e645a284d 100644 --- a/meta-oe/recipes-devtools/php/php_8.2.9.bb +++ b/meta-oe/recipes-devtools/php/php_8.2.9.bb | |||
@@ -44,7 +44,7 @@ CVE_STATUS_PHP = " \ | |||
44 | CVE-2007-4596 \ | 44 | CVE-2007-4596 \ |
45 | " | 45 | " |
46 | 46 | ||
47 | inherit autotools pkgconfig python3native gettext multilib_header multilib_script | 47 | inherit autotools pkgconfig python3native gettext multilib_header multilib_script systemd |
48 | 48 | ||
49 | # phpize is not scanned for absolute paths by default (but php-config is). | 49 | # phpize is not scanned for absolute paths by default (but php-config is). |
50 | # | 50 | # |
@@ -193,11 +193,11 @@ do_install:append:class-target() { | |||
193 | install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf | 193 | install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf |
194 | 194 | ||
195 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then | 195 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then |
196 | install -d ${D}${systemd_unitdir}/system | 196 | install -d ${D}${systemd_system_unitdir} |
197 | install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/ | 197 | install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_system_unitdir}/php-fpm.service |
198 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | 198 | sed -i -e 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${systemd_system_unitdir}/php-fpm.service |
199 | -e 's,@LOCALSTATEDIR@,${localstatedir},g' \ | 199 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/php-fpm.service |
200 | ${D}${systemd_unitdir}/system/php-fpm.service | 200 | sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/php-fpm.service |
201 | fi | 201 | fi |
202 | 202 | ||
203 | if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then | 203 | if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then |
@@ -259,7 +259,7 @@ FILES:${PN}-cli = "${bindir}/php" | |||
259 | FILES:${PN}-phpdbg = "${bindir}/phpdbg" | 259 | FILES:${PN}-phpdbg = "${bindir}/phpdbg" |
260 | FILES:${PN}-phar = "${bindir}/phar*" | 260 | FILES:${PN}-phar = "${bindir}/phar*" |
261 | FILES:${PN}-cgi = "${bindir}/php-cgi" | 261 | FILES:${PN}-cgi = "${bindir}/php-cgi" |
262 | FILES:${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${systemd_unitdir}/system/php-fpm.service ${sysconfdir}/php-fpm.d/www.conf.default" | 262 | FILES:${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${sysconfdir}/php-fpm.d/www.conf.default" |
263 | FILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" | 263 | FILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" |
264 | CONFFILES:${PN}-fpm = "${sysconfdir}/php-fpm.conf" | 264 | CONFFILES:${PN}-fpm = "${sysconfdir}/php-fpm.conf" |
265 | CONFFILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" | 265 | CONFFILES:${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf" |
@@ -290,6 +290,9 @@ RPROVIDES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" | |||
290 | RREPLACES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" | 290 | RREPLACES:${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
291 | RCONFLICTS:${PN}-modphp = "${MODPHP_OLDPACKAGE}" | 291 | RCONFLICTS:${PN}-modphp = "${MODPHP_OLDPACKAGE}" |
292 | 292 | ||
293 | SYSTEMD_SERVICE:${PN}-fpm = "php-fpm.service" | ||
294 | SYSTEMD_PACKAGES += "${PN}-fpm" | ||
295 | |||
293 | do_install:append:class-native() { | 296 | do_install:append:class-native() { |
294 | create_wrapper ${D}${bindir}/php \ | 297 | create_wrapper ${D}${bindir}/php \ |
295 | PHP_PEAR_SYSCONF_DIR=${sysconfdir}/ | 298 | PHP_PEAR_SYSCONF_DIR=${sysconfdir}/ |