Score:0

Unable to start php-fpm service after boot on Ubuntu 22.04

sc flag

Hello Ubuntu Community,

i am running a small Ubuntu Server within my home network with various web services like vaultwarden, nextcloud, seeddms, etc. on it using a nginx web server. I had multiple PHP versions installed, but only was using PHP 7.4 for nginx. So I decided to purge all installed PHP versions to clean everything a little bit up and only installing PHP 8.1 with all needed php8.1 extensions like php8.1-fpm etc. Of course I changed the config of nginx to use the newly installed php8.1 version.

Now here comes the problem. I really don't know why this is happening or rather what led to it, but the php8.1 service isn't able to properly start anymore since my local PHP cleanup.

The command sudo systemctl start php8.1-fpm gives me following error message:

Take a look at error message

I found out that when I create a folder named "php" manually within the path /var/run/ I am able to start the service successfully, but this is only working until the next boot, than the same thing happens over again. After booting it is the same error. The manually created folder /var/run/php is not there anymore.

I know that /var/run is a temporary folder location, but something must be wrong with my installation because why does not the php folder gets created at startup or something like that by default. I never had to deal with this before.

There are some threads out there with similar error messages but they weren't helpful in my case. Currently I am using a workaround by creating that folder by a script at startup but that really isn't a nice solution and I really don't want to leave it like that it would be bad practice, so please no workaround solutions. I want to find the underlying reason of the problem.

Some further information (command outputs, config files etc.) which can help you to find the problem:

Results of php -v :

PHP 8.1.14 (cli) (built: Jan  6 2023 15:23:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies
with Zend OPcache v8.1.14, Copyright (c), by Zend Technologies

Results of update-alternatives --list php :

/usr/bin/php8.1

Results of sudo nano /lib/systemd/system/php8.1-fpm.service :

[Unit]
Description=The PHP 8.1 FastCGI Process Manager
Documentation=man:php-fpm8.1(8)
After=network.target

[Service]
Type=notify
ExecStart=/usr/sbin/php-fpm8.1 --nodaemonize --fpm-config /etc/php/8.1/fpm/php-fpm.conf
ExecStartPost=-/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81
ExecStopPost=-/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

Results of systemctl start php8.1-fpm :

Job for php8.1-fpm.service failed because the control process exited with error code.
See "systemctl status php8.1-fpm.service" and "journalctl -xeu php8.1-fpm.service" for details.

Results of sudo journalctl -xeu php8.1-fpm.service :

sudo journalctl -xeu php8.1-fpm.service

If you need to see some config files or the results of different commands let me know,n and I will post them here.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.