Ubuntu 17.10 升级至 18.04 后 PHP 无法运行

Ubuntu 17.10 升级至 18.04 后 PHP 无法运行

我刚刚将 Ubuntu 17.10 升级到 18.04,php 停止工作。我重新启动了 Apache,并尝试了在网上找到的一些解决方案,例如

sudo a2enmod php7.1
sudo systemctl restart apache2

但它仍然不起作用。

$ journalctl -xe -u apache2

-- Unit apache2.service has failed.
-- 
-- The result is RESULT.
-- Reboot --
Nis 29 02:31:21 hasan systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has begun starting up.
Nis 29 02:31:28 hasan apachectl[947]: apache2: Syntax error on line 146 of /etc/
Nis 29 02:31:28 hasan apachectl[947]: Action 'start' failed.
Nis 29 02:31:28 hasan apachectl[947]: The Apache error log may have more informa
Nis 29 02:31:28 hasan systemd[1]: apache2.service: Control process exited, code=
Nis 29 02:31:28 hasan systemd[1]: apache2.service: Failed with result 'exit-code
Nis 29 02:31:28 hasan systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit apache2.service has failed.
-- 
-- The result is RESULT.

我怎样才能解决这个问题?

答案1

我重新安装了 php,现在可以正常工作了。

彻底删除 php

sudo apt-get --purge --autoremove php7.0 php7.0-common

然后重新安装 php 7.0

 sudo apt-get install php7.0 

相关内容