FS#64683 - [php-fpm] doesn't start: failed to chown the socket /run/php-fpm/php-fpm.sock
Attached to Project:
Arch Linux
Opened by Sebastiaan Lokhorst (lonaowna) - Friday, 29 November 2019, 19:06 GMT
Last edited by Doug Newgard (Scimmia) - Tuesday, 03 December 2019, 05:46 GMT
Opened by Sebastiaan Lokhorst (lonaowna) - Friday, 29 November 2019, 19:06 GMT
Last edited by Doug Newgard (Scimmia) - Tuesday, 03 December 2019, 05:46 GMT
|
Details
php-fpm.service fails to start after upgrading to php 7.4.0.
Using the default configuration files.
systemctl status php-fpm.service: systemd[1]: Starting The PHP FastCGI Process Manager... php-fpm[10704]: [ERROR] [pool www] failed to chown() the socket '/run/php-fpm/php-fpm.sock': Operation not permitted (1) php-fpm[10704]: [ERROR] [pool www] failed to chown() the socket '/run/php-fpm/php-fpm.sock': Operation not permitted (1) php-fpm[10704]: [ERROR] FPM initialization failed php-fpm[10704]: [ERROR] FPM initialization failed systemd[1]: php-fpm.service: Main process exited, code=exited, status=78/CONFIG systemd[1]: php-fpm.service: Failed with result 'exit-code'. systemd[1]: Failed to start The PHP FastCGI Process Manager. |
This task depends upon
This bug has apparently just graduated to `extra`:
```
$ pacman -Si php-fpm | egrep 'Repository|Name|Version'
Repository : extra
Name : php-fpm
Version : 7.4.0-1
$ pacman -Qi php-fpm | egrep 'Name|Version'
Name : php-fpm
Version : 7.4.0-1
$ journalctl -e -u php-fpm -n8
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name systemd[1]: Starting php-fpm.service...
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name php-fpm[643236]: [ERROR] [pool www] failed to chown() the socket '/run/php-fpm/php-fpm.sock': Operation not permitted (1)
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name php-fpm[643236]: [ERROR] [pool www] failed to chown() the socket '/run/php-fpm/php-fpm.sock': Operation not permitted (1)
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name php-fpm[643236]: [ERROR] FPM initialization failed
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name php-fpm[643236]: [ERROR] FPM initialization failed
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name systemd[1]: php-fpm.service: Main process exited, code=exited, status=78/CONFIG
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name systemd[1]: php-fpm.service: Failed with result 'exit-code'.
Nov 30 00:06:53 stratofortress.nexus.i.intelfx.name systemd[1]: Failed to start php-fpm.service.
```
Nov 29 21:59:19 server php-fpm[1604]: [29-Nov-2019 21:59:19] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'igbinary.so' (tried: /usr/lib/php/modules/igbinary.so (/usr/lib/php/modules/igbinary.so: undefined symbol: php_error_docref0), /usr/lib/php/modules/igbinary.so.so (/usr/lib/php/modules/igbinary.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Nov 29 21:59:19 server php-fpm[1604]: [29-Nov-2019 21:59:19] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'imagick' (tried: /usr/lib/php/modules/imagick (/usr/lib/php/modules/imagick: cannot open shared object file: No such file or directory), /usr/lib/php/modules/imagick.so (/usr/lib/php/modules/imagick.so: undefined symbol: add_next_index_zval)) in Unknown on line 0
Nov 29 21:59:19 server php-fpm[1604]: [29-Nov-2019 21:59:19] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'inotify.so' (tried: /usr/lib/php/modules/inotify.so (/usr/lib/php/modules/inotify.so: undefined symbol: add_next_index_zval), /usr/lib/php/modules/inotify.so.so (/usr/lib/php/modules/inotify.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Nov 29 21:59:19 server php-fpm[1604]: [29-Nov-2019 21:59:19] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'redis' (tried: /usr/lib/php/modules/redis (/usr/lib/php/modules/redis: cannot open shared object file: No such file or directory), /usr/lib/php/modules/redis.so (/usr/lib/php/modules/redis.so: undefined symbol: add_next_index_zval)) in Unknown on line 0
Nov 29 21:59:19 server php-fpm[1604]: [ERROR] [pool www] failed to chown() the socket '/run/php-fpm/php-fpm.sock': Operation not permitted (1)
Nov 29 21:59:19 server php-fpm[1604]: [ERROR] [pool www] failed to chown() the socket '/run/php-fpm/php-fpm.sock': Operation not permitted (1)
Nov 29 21:59:19 server php-fpm[1604]: [ERROR] FPM initialization failed
Nov 29 21:59:19 server php-fpm[1604]: [ERROR] FPM initialization failed
Nov 29 21:59:19 server systemd[1]: php-fpm.service: Main process exited, code=exited, status=78/CONFIG
Nov 29 21:59:19 server systemd[1]: php-fpm.service: Failed with result 'exit-code'.
Nov 29 21:59:19 server systemd[1]: Failed to start The PHP FastCGI Process Manager.
So, apart from the socket permission/ownership issue, there are also dependencies missing if one uses modules, like for nextcloud.
In /etc/php/php-fpm.d/www.conf replace
;listen.acl_users =
;listen.acl_groups =
with
listen.acl_users = http
listen.acl_groups = http
;listen.owner = http
;listen.group = http
to avoid
[WARNING] [pool www] ACL set, listen.owner = 'http' is ignored
[WARNING] [pool www] ACL set, listen.group = 'http' is ignored
in systemctl status php-fpm.service
This is cleaner than adding CAP_CHOWN, but I can't confirm if this fixes the additional missing dependencies issue as reported by Olav above. Thanks for your suggestion.
Updated the upstream bug report to account for @loqs suggestion.
@loqs's way works for me. Thanks.
2019/12/01 02:22:46 [error] 323#323: *11 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
worked and no errors
http://cms.local/
2019/12/01 13:22:05 [error] 1665#1665: *21 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: cms.local, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "cms.local"
# ls -l /run/php-fpm/php-fpm.sock
srw-rw----+ 1 root root 0 Dec 1 13:04 /run/php-fpm/php-fpm.sock
# getfacl /run/php-fpm/php-fpm.sock
getfacl: Removing leading '/' from absolute path names
# file: run/php-fpm/php-fpm.sock
# owner: root
# group: root
user::rw-
user:http:rw-
group::rw-
group:http:rw-
mask::rw-
other::---
/etc/nginx/nginx.conf
server {
listen 80 http2;
server_name cms.local;
root /home/www/cms.local/htdocs;
error_log /home/www/cms.local/error.log warn;
access_log /home/www/cms.local/access.log;
expires 365d;
gzip on;
gzip_types text/plain text/css application/json application/javascript;
location / {
index index.html /.cms/index.php;
default_type text/html;
try_files $uri $uri/ /.cms/index.php?$query_string;
}
location ~ \.php$ {
expires off;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_buffering off;
fastcgi_request_buffering off;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ /\. {
deny all;
}
location /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
location /pma/ {
alias /usr/share/webapps/phpMyAdmin/;
index index.php;
client_max_body_size 200m;
location ~ /pma/(.+\.php) {
root /usr/share/webapps/phpMyAdmin;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/phpMyAdmin/$1;
}
}
}
pma.png (156.7 KiB)
error_log = log/php-fpm.log
# tail -f /var/log/php-fpm.log
[01-Dec-2019 13:38:32] NOTICE: fpm is running, pid 1933
[01-Dec-2019 13:38:32] NOTICE: ready to handle connections
[01-Dec-2019 13:38:32] NOTICE: systemd monitor interval set to 10000ms
... no errors
Thanks! I was wondering why my sites stopped working. :/
They are indeed listed in the /home/.. directory.
;listen.owner = http
;listen.group = http
listen.acl_users = http
listen.acl_groups = http
See bug https://bugs.archlinux.org/task/64717