最新升级禁用了 apache2 的 php7

最新升级禁用了 apache2 的 php7

请告诉我您需要什么日志才能解决这个问题。

root@BudanParakeet:/etc/apache2/mods-enabled# uname -v
#19-Ubuntu SMP Wed Oct 11 18:33:49 UTC 2017
root@BudanParakeet:/etc/apache2/mods-enabled#

root@BudanParakeet:/etc/apache2/mods-enabled# vi php7.0.conf 
root@BudanParakeet:/etc/apache2/mods-enabled# service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl  status apache2.service" and "journalctl  -xe" for details.
root@BudanParakeet:/etc/apache2/mods-enabled# journalctl -xe
-- Unit UNIT has finished starting up.
-- 
-- The start-up result is done.
nov 05 18:35:57 BudanParakeet 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.
nov 05 18:35:57 BudanParakeet apachectl[4502]: apache2: Syntax error on line 146 of /etc/apache2/apache2.c
nov 05 18:35:57 BudanParakeet apachectl[4502]: Action 'start' failed.
nov 05 18:35:57 BudanParakeet apachectl[4502]: The Apache error log may have more information.
nov 05 18:35:57 BudanParakeet systemd[1]: apache2.service: Control process exited, code=exited status=1
nov 05 18:35:57 BudanParakeet 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 failed.
nov 05 18:35:57 BudanParakeet systemd[1]: apache2.service: Unit entered failed state.
nov 05 18:35:57 BudanParakeet systemd[1]: apache2.service: Failed with result 'exit-code'.

答案1

问题可能是,Ubuntu 17.10 附带 PHP 7.1,但 Apache 的 php 模块尚未更新。因此解决方案可能是禁用并删除旧模块并安装并启用新模块:

sudo a2dismod php7.0
sudo apt remove libapache2-mod-php7.0
sudo apt install libapache2-mod-php7.1
sudo a2enmod php7.1
sudo systemctl restart apache2.service

相关内容