刚刚从 19.10 升级到 ubuntu 20.04。重启后我发现我的 apache 服务器失败了。
我运行后systemctl restart apache2
显示
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
然后我跑了systemctl status apache2.service
,给了这个
● 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.
这是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.
我应该怎么办?
答案1
当我从 Ubuntu 18.04 升级时,我遇到了同样的问题。在升级过程中,我的 php 包 7.2 被删除了。但是,升级过程并没有删除 php7.2 配置。因此,我不得不禁用 php7.2 mod 并安装最新版本的 php,即 7.4。
在您的情况下,您必须禁用 php7.3 并安装 php7.4。
我使用了以下命令:
sudo a2dismod php7.3
sudo a2enmod php7.4
要撤消,请使用以下命令:
sudo a2dismod php7.4
sudo a2enmod php7.3
要列出 apache2 mods,请使用以下命令:
sudo a2query -m
进行任何更改后,您将需要重新启动 apache2。
sudo service apache2 restart