Tuesday, April 12, 2022

[SOLVED] Failed to start The PHP 8.0 FastCGI Process when update to php8.0

Issue

I am trying to update from php7.4 to php8.0

I applied the following steps

sudo apt update
sudo apt upgrade

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

apt-get install php8.0 php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-fpm php8.0-gd php8.0-intl php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-pspell php8.0-readline php8.0-xml php8.0-zip php8.0-imagick

But I got the error

php8.0-fpm.service - The PHP 8.0 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php8.0-fpm.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2022-03-25 19:49:43 +03; 10ms ago
     Docs: man:php-fpm8.0(8)
  Process: 6949 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.0/fpm/pool.d/www.conf 80 (code=exited, status=0/SUCCESS)
  Process: 6941 ExecStart=/usr/sbin/php-fpm8.0 --nodaemonize --fpm-config /etc/php/8.0/fpm/php-fpm.conf (code=exited, status=78)
 Main PID: 6941 (code=exited, status=78)


Mar 25 19:48:53 server.aaaaaa.com systemd[1]: Starting The PHP 8.0 FastCGI Process Manager...
Mar 25 19:48:53 server.aaaaaa.com php-fpm8.0[6224]: [25-Mar-2022 19:48:53] ERROR: failed to open configuration file '/etc/php/8.0/fpm/php-fpm.conf': No such file or directory (2)
Mar 25 19:48:53 server.aaaaaa.com php-fpm8.0[6224]: [25-Mar-2022 19:48:53] ERROR: failed to load configuration file '/etc/php/8.0/fpm/php-fpm.conf'
Mar 25 19:48:53 server.aaaaaa.com php-fpm8.0[6224]: [25-Mar-2022 19:48:53] ERROR: FPM initialization failed
Mar 25 19:48:53 server.aaaaaa.com systemd[1]: php8.0-fpm.service: Main process exited, code=exited, status=78/n/a
Mar 25 19:48:53 server.aaaaaa.com systemd[1]: php8.0-fpm.service: Failed with result 'exit-code'.
Mar 25 19:48:53 server.aaaaaa.com systemd[1]: Failed to start The PHP 8.0 FastCGI Process Manager.
dpkg: error processing package php8.0-fpm (--configure):
 installed php8.0-fpm package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 php8.0-fpm
E: Sub-process /usr/bin/dpkg returned an error code (1)

Knowing that there is no "php-fpm.conf" file in "/etc/php/8.0/fpm/"


Solution

By logs I see somehow You've lost config file: /etc/php/8.0/fpm/php-fpm.conf

So I found one in my server and put to Gist.

Need to put that on Your server.

In terminal:

cd ~

wget https://gist.githubusercontent.com/num8er/6cf84e1a544cc7751d3f6974d10b10a0/raw/d9bf057d3acc297d79235b282319f29f60a4301b/php-fpm.conf

sudo mv php-fpm.conf /etc/php/8.0/fpm/php-fpm.conf

sudo systemctl restart php8.0-fpm

if You still have issues, uninstall all php stuff, and install again:

apt purge -y php7.4*

apt purge -y php8.0*

apt-get install php8.0 php8.0-fpm php8.0-dev php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-gd php8.0-intl php8.0-mbstring php8.0-mysql php8.0-mysqli php8.0-pdo php8.0-opcache php8.0-pspell php8.0-readline php8.0-xml php8.0-zip php8.0-imagick


Answered By - num8er
Answer Checked By - David Marino (WPSolving Volunteer)