Question: Apache is failing to start on a Plesk server: "Cannot load /usr/lib/apache2/modules/libphp7.4.so into server"
Applicable to:Symptoms- The Apache web server is failing to start on a Plesk server
- Last lines from CLI command journalctl -xeu apache2 are:
Aug 31 10:09:44 server systemd[1]: Starting The Apache HTTP Server...
Aug 31 10:09:44 server apachectl[953]: 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 directory
Aug 31 10:09:44 server apachectl[920]: Action 'start' failed.
Aug 31 10:09:44 server apachectl[920]: The Apache error log may have more information.
Aug 31 10:09:44 server systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Aug 31 10:09:44 serverr systemd[1]: apache2.service: Failed with result 'exit-code'.
Aug 31 10:09:44 server systemd[1]: Failed to start The Apache HTTP Server.
CauseApache is trying to load PHP 7.4 provided by OS vendor which is not installed on the server.
Resolution
Move the following files:
#mv /etc/apache2/mods-enabled/php7.2.load /root/php7.4.load
#mv /etc/apache2/mods-enabled/php7.4.conf /root/php7.4.conf
Restart the Apache service:
#systemctl restart apache2.service