-1

Issue

I updated my PHP version from 7.2 to 8.0.5

I followed this guide to update my PHP

I ran this sudo apt-get purge php7.* to remove my php 7 version.

Now when I browse to my website i just get the php codeliek

<?php

/* ton of code here */

when I enable

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.0-fpm

i get an error of

Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later

when browsing to the website

Edit 1:

[Sat May 22 12:21:03.453315 2021] [proxy:error] [pid 511723] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.0-fpm.sock (*) fai>
[Sat May 22 12:21:03.453398 2021] [proxy_fcgi:error] [pid 511723] [client 102.223.225.133:63119] AH01079: failed to make connection to backend: httpd-UDS

Edit 2:

after running sudo systemctl list-units --failed i see

● php8.0-fpm.service     loaded failed failed The PHP 8.0 FastCGI Process Manager  

Edit 3:

my apache user is safe-www

Edit 4:

/var/log/apache2/error.log

[Sat May 22 12:33:52.354558 2021] [mpm_prefork:notice] [pid 2763] AH00163: Apache/2.4.41 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.1f configured -- resuming normal operations
[Sat May 22 12:33:52.354654 2021] [core:notice] [pid 2763] AH00094: Command line: '/usr/sbin/apache2'

site.error.log

[Sat May 22 12:33:54.737169 2021] [proxy:error] [pid 2765] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php8.0-fpm.sock (*) failed
[Sat May 22 12:33:54.737233 2021] [proxy_fcgi:error] [pid 2765] [client 102.223.225.133:63281] AH01079: failed to make connection to backend: httpd-UDS

Edit 5:

/var/log/apache2/error.log

[Sat May 22 12:45:10.817186 2021] [mpm_prefork:notice] [pid 5482] AH00163: Apache/2.4.41 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.1.1f configured -- resuming normal operations
[Sat May 22 12:45:10.817273 2021] [core:notice] [pid 5482] AH00094: Command line: '/usr/sbin/apache2

site.error.log

AH01070: Error parsing script headers
[Sat May 22 12:45:13.311597 2021] [proxy_fcgi:error] [pid 5484] (22)Invalid argument: [client 102.223.225.133:63477] AH01075: Error dispatching request to :

Edit 6:

[ - ]  apache-htcacheclean
 [ + ]  apache2
 [ + ]  apparmor
 [ + ]  apport
 [ + ]  atd
 [ + ]  chrony
 [ - ]  console-setup.sh
 [ + ]  cron
 [ - ]  cryptdisks
 [ - ]  cryptdisks-early
 [ + ]  dbus
 [ + ]  grub-common
 [ - ]  hwclock.sh
 [ - ]  iscsid
 [ - ]  keyboard-setup.sh
 [ + ]  kmod
 [ - ]  lvm2
 [ - ]  lvm2-lvmpolld
 [ + ]  multipath-tools
 [ - ]  open-iscsi
 [ - ]  open-vm-tools
 [ + ]  php8.0-fpm
 [ - ]  plymouth
 [ - ]  plymouth-log
 [ + ]  procps
 [ - ]  rsync
 [ + ]  rsyslog
 [ - ]  screen-cleanup
 [ + ]  ssh
 [ + ]  udev
 [ + ]  ufw
 [ + ]  unattended-upgrades
 [ - ]  uuidd
 [ - ]  x11-common

Edit 7:

Solution

2
  • What do you see in your Apache logs? There should be something in the /var/log/apache2/error.log file or one of the site-specific error logs letting you know why you are getting a 503 error code.
    – matigo
    May 22, 2021 at 12:18
  • @matigo see edit
    – X3R0
    May 22, 2021 at 12:22

2 Answers 2

6

If you uninstalled PHP 7.x after installing PHP 8.0, then there was probably a bit of overlap that has taken out your PHP 8.0 installation. A slight re-install might be in order.

Try this:

sudo apt install --reinstall php8.0 libapache2-mod-php8.0
sudo a2enconf php8.0-fpm
sudo service apache2 restart

That will re-load PHP 8.0, ensure the modules are in place and intact, enable the FastCGI Process Manager, then restart Apache. Generally, this is the process that people need to follow when a similar issue happens with PHP7.x.

Following up ...

The AH01079: failed to make connection to backend: httpd-UDS is sometimes caused by a bum service that needs to be restarted. I don't use PHP8.0, so can't guess at the name of the service, but you can list all services running on your system like this:

sudo service --status-all

This will give you a list of services with a [-] to signify it's inactive, and [+] to mean it's running. You will want to look for a service that looks something like php80-php-fpm and restart it:

sudo service php80-php-fpm restart

This may resolve the issue.

If Contending with a Proxy Issue ...

On occasion there may be an issue if using proxy_fcgi and the send buffers do not fill one frame of data. This can be worked around by editing the Apache configuration for the affected site to include this:

<IfModule proxy_module>
    ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000/var/www/html/$1
</IfModule>

<IfModule mod_deflate.c>
    SetOutputFilter DEFLATE

    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpeg|jpg|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
</IfModule>

Hopefully this resolves the final issue.

15
  • still not working
    – X3R0
    May 22, 2021 at 12:33
  • please see edit 4
    – X3R0
    May 22, 2021 at 12:36
  • 1
    "Not working" is an incomplete statement, as your FastCGI Process Manager is actually loading now. The "file not found" issue is new :P
    – matigo
    May 22, 2021 at 12:38
  • Glad we getting there, not sure what to do man, I've never had this issue before. plz help :)
    – X3R0
    May 22, 2021 at 12:39
  • 1
    In every enabled Apache config you have in /etc/apache2/sites-enabled.
    – matigo
    May 22, 2021 at 14:21
3

I had a similar issue after upgrading to Ubuntu 22.04 (jammy). The upgrade installed php8.1 and after that apache did not execute .php files anymore. There were no error messages in error.log.

I was sure that I had all the necessary packages for php8.1 installed. What finally fixed it for me was this:

sudo apt install libapache2-mod-php8.0
sudo service apache2 restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .