I see there is already a question very similar to mine, but with a slightly different issue. I hope this will not break any rules.I have a web server running a LEMP stack where I upgraded Ubuntu from 20.04 LTS to 22.04 LTS. Everything works fine except that PhpMyAdmin is no longer working. I reinstalled the PhpMyAdmin package and it went without issues or warnings but it still does not work.I did check nginx, PHP, Mariadb and they are all running. The only one not started is Apache2 as can be seen as the output of sudo systemctl status apache2.service -l --no-pager
.
× apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2024-05-21 18:36:48 UTC; 1h 17min ago Docs: https://httpd.apache.org/docs/2.4/ Process: 35426 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE) CPU: 9msMay 21 18:36:48 systemd[1]: Starting The Apache HTTP Server...May 21 18:36:48 apachectl[35429]: apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.4.load: Cannot load /usr/lib/apache2/modules/libphp7.4.so into server: /usr/lib/apache2/modules/libphp7.4.so: cannot open shared object file: No such file or directoryMay 21 18:36:48 apachectl[35426]: Action 'start' failed.May 21 18:36:48 apachectl[35426]: The Apache error log may have more information.May 21 18:36:48 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILUREMay 21 18:36:48 systemd[1]: apache2.service: Failed with result 'exit-code'.May 21 18:36:48 systemd[1]: Failed to start The Apache HTTP Server.
Next, commands journalctl -u apache2.service
and sudo apachectl configtest
basically gave me the same error again:
apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.4.load: Cannot load /usr/lib/apache2/modules/libphp7.4.so into server: /usr/lib/apache2/modules/libphp7.4.so: cannot open shared object file: No such file or directoryAction 'configtest' failed.The Apache error log may have more information.
Line 146 of /etc/apache2/apache2.conf looks OK to me: IncludeOptional mods-enabled/*.load
.Then, line 3 of /etc/apache2/mods-enabled/php7.4.load:
is a Simlink, and I noticed there were only the ones for 7.4 so I added the ones for 8.1 to no avail:
lrwxrwxrwx 1 root root 34 Jun 12 2021 negotiation.load -> ../mods-available/negotiation.loadlrwxrwxrwx 1 root root 29 Jun 12 2021 php7.4.conf -> ../mods-available/php7.4.conflrwxrwxrwx 1 root root 29 Jun 12 2021 php7.4.load -> ../mods-available/php7.4.loadlrwxrwxrwx 1 root root 39 May 21 14:19 php8.1.conf -> /etc/apache2/mods-available/php8.1.conflrwxrwxrwx 1 root root 39 May 21 14:20 php8.1.load -> /etc/apache2/mods-available/php8.1.load
Finally, I realized that the file /usr/lib/apache2/modules/libphp7.4.so
does not exist on my server, only /usr/lib/apache2/modules/libphp8.1.so
.So, the question is how do I fix this?Any input would be greatly appreciated.