1
> mei 25 16:20:42 parakeet apachectl[15124]: apache2: Syntax error on line 148 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php8.1.load: Cannot load /usr/lib/apache2/modules/libphp8.1.so into server: /usr/lib/apache2/modules/libphp8.1.so: cannot open shared object file: No such file or directory

> mei 25 16:20:42 parakeet systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ An ExecStop= process belonging to unit apache2.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
mei 25 16:20:42 parakeet systemd[1]: apache2.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit apache2.service has entered the 'failed' state with result 'exit-code'.


> root@parakeet:~# dpkg -l | grep php
> ii  libapache2-mod-php8.3                                    8.3.6-0maysync1                             amd64        server-side, HTML-embedded scripting language (Apache 2 module)
> ii  php                                                      2:8.3+93ubuntu2                             all          server-side, HTML-embedded scripting language (default)
> ii  php-common                                               2:93ubuntu2                                 all          Common files for PHP packages
> ii  php8.3                                                   8.3.6-0maysync1                             all          server-side, HTML-embedded scripting language (metapackage)
> ii  php8.3-cli                                               8.3.6-0maysync1                             amd64        command-line interpreter for the PHP scripting language
> ii  php8.3-common                                            8.3.6-0maysync1                             amd64        documentation, examples and common module for PHP
> ii  php8.3-opcache                                           8.3.6-0maysync1                             amd64        Zend OpCache module for PHP
> ii  php8.3-readline                                          8.3.6-0maysync1                             amd64        readline module for PHP
> root@parakeet:~# apt install php8.3
> Reading package lists... Done
> Building dependency tree... Done
> Reading state information... Done
> php8.3 is already the newest version (8.3.6-0maysync1).
> php8.3 set to manually installed.
> 0 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.

2 Answers 2

2

Your Apache is configured to use PHP 8.1 but you only have PHP 8.3. There are two ways to fix this: configure Apache to use PHP 8.3 or install PHP 8.1.

Configure Apache to use PHP 8.3

You Apache server is trying to load the libphp8.1 module and you don't have that. You can fix it by disabling this module and enabling PHP 8.3:

sudo a2dismod php8.1
sudo a2enmod php8.3
sudo service apache2 restart

Install PHP 8.1

To install PHP 8.1 on Ubuntu 24.04, you need to add the ppa:ondrej/php repository, because php8.1 package is not in the official repos.

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt upgrade
sudo apt install php8.1
sudo service apache2 restart
-1

Turns out I had /etc/letsencrypt, /etc/apache2 and /etc/nginx backed up and then restored with a mere cp -rv command, and this installed the php8.1 module for me.

Going into /etc/apache2/mods-enabled and deleting php8.1.* there, as well as deleting all files that nginx complains about in /etc/nginx/modules-enabled, got my webserver up.

I am now in the process of restoring the webserver's data.

3
  • 1
    Congrats on fixing it yourself. However, it sounds like you are creating even bigger mess. Just copy/pasting and deleting files and modules is a recipe for a disaster :) Try using the apt package manager to maintain your PHP versions and modules. Also use a2dismod to disable Apache modules.
    – sotirov
    Commented May 25 at 17:53
  • I agree with sotirov; I'd urge you to fix stuff the "right" way, which is outlined in sotirov's answer. Manually removing the symlink in /etc/apache2/mods-enabled instead of a2dismod is fine, copying over files from an old installation leaves you, even if you manage to do it well, with an ambiguous situation where your package manager doesn'r realize you have PHP 8.1 installed. Which is undesirable, especially since you have alternatives.
    – kos
    Commented May 26 at 0:22
  • noted for future reference :) thanks. Commented May 26 at 21:04

You must log in to answer this question.

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