Ubuntu
在 Ubuntu 16.04 上安裝 php5 和 php7 後,Apache2 無法啟動
我在Ubuntu 16.04上使用php7執行****Apache2。但除此之外,我還安裝了php5。
- 安裝php5後我執行
sudo a2enmod php5.6
- 然後我重新啟動了apache2
sudo service apache2 restart
但是Apache2不會啟動。
執行後
systemctl status apache2.service
我得到:● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; generated; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: failed (Result: exit-code) since Wed 2016-10-19 20:07:51 BST; 6s ago Docs: man:systemd-sysv-generator(8) Process: 7656 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS Process: 7748 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILU Oct 19 20:07:51 tulik apache2[7748]: * Oct 19 20:07:51 tulik apache2[7748]: * The apache2 configtest failed. Oct 19 20:07:51 tulik apache2[7748]: Output of config test was: Oct 19 20:07:51 tulik apache2[7748]: Segmentation fault (core dumped) Oct 19 20:07:51 tulik apache2[7748]: Action 'configtest' failed. Oct 19 20:07:51 tulik apache2[7748]: The Apache error log may have more informat Oct 19 20:07:51 tulik systemd[1]: apache2.service: Control process exited, code= Oct 19 20:07:51 tulik systemd[1]: Failed to start LSB: Apache2 web server. Oct 19 20:07:51 tulik systemd[1]: apache2.service: Unit entered failed state. Oct 19 20:07:51 tulik systemd[1]: apache2.service: Failed with result 'exit-code
問題是我沒有禁用 php7.0 mod。
我跑
sudo a2dimod php7.0
了,現在一切正常。現在可以輕鬆地在PHP版本之間切換。