3

Just upgraded to ubuntu 20.04 from 19.10. and after the restart I noticed my apache server is failed.
I ran systemctl restart apache2 that showed

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.


then i ran systemctl status apache2.service that gave this

 ● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor prese>
     Active: failed (Result: exit-code) since Fri 2020-05-08 02:14:14 +06; 22s >
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 3271 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FA>

May 08 02:14:14 mahmud systemd[1]: Starting The Apache HTTP Server...
May 08 02:14:14 mahmud apachectl[3281]: apache2: Syntax error on line 146 of /e>
May 08 02:14:14 mahmud apachectl[3271]: Action 'start' failed.
May 08 02:14:14 mahmud apachectl[3271]: The Apache error log may have more info>
May 08 02:14:14 mahmud systemd[1]: apache2.service: Control process exited, cod>
May 08 02:14:14 mahmud systemd[1]: apache2.service: Failed with result 'exit-co>
May 08 02:14:14 mahmud systemd[1]: Failed to start The Apache HTTP Server.

Here's the apachectl configtest

apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.3.load: Cannot load /usr/lib/apache2/modules/libphp7.3.so into server: /usr/lib/apache2/modules/libphp7.3.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.

what should I do?

  • Fix the weeoe on line 146 of /etc/apache2/apache2.conf ... what ever it is. – Soren A May 7 at 21:56
  • It was conflict between 2 php version. Disabling previous version did the trick – MH Sagar May 7 at 22:19
4

I had the same problem when i upgraded from Ubuntu 18.04. During the upgrade process, my php package 7.2 was removed. However, the upgrade process did not remove php7.2 configurations. Thus, I had to disable the php7.2 mod and install the latest version of php, which is 7.4.

In your case, you will have to disable php7.3 and install php7.4.

I used the following commands:

sudo a2dismod php7.3
sudo a2enmod php7.4

To undo use the following command:

sudo a2dismod php7.4
sudo a2enmod php7.3

To list apache2 mods use the following:

sudo a2query -m

After you make any changes, you will need to restart apache2.

sudo service apache2 restart
| improve this answer | |
  • 1
    Just using a2dismod php7.3 was enough still I used a2enmod php7.4 and its working perfectly. Thanks – MH Sagar May 7 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.