
我在 15.10 上安裝了 lamp。它正在工作。昨天我已將我的 ubuntu 計算機從 15.10 更新到 16.04。我嘗試存取本地主機但沒有成功。
我已嘗試service apache2 restart
並收到以下錯誤:
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Sun 2017-06-25 13:50:20 IST; 1min 0s ago
Docs: man:systemd-sysv-generator(8)
Process: 5414 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Jun 25 13:50:20 ajay-Lenovo-G50-70 apache2[5414]: *
Jun 25 13:50:20 ajay-Lenovo-G50-70 apache2[5414]: * The apache2 configtest failed.
Jun 25 13:50:20 ajay-Lenovo-G50-70 apache2[5414]: Output of config test was:
Jun 25 13:50:20 ajay-Lenovo-G50-70 apache2[5414]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
Jun 25 13:50:20 ajay-Lenovo-G50-70 apache2[5414]: Action 'configtest' failed.
Jun 25 13:50:20 ajay-Lenovo-G50-70 apache2[5414]: The Apache error log may have more information.
Jun 25 13:50:20 ajay-Lenovo-G50-70 systemd[1]: apache2.service: Control process exited, code=exited status=1
Jun 25 13:50:20 ajay-Lenovo-G50-70 systemd[1]: Failed to start LSB: Apache2 web server.
Jun 25 13:50:20 ajay-Lenovo-G50-70 systemd[1]: apache2.service: Unit entered failed state.
Jun 25 13:50:20 ajay-Lenovo-G50-70 systemd[1]: apache2.service: Failed with result 'exit-code'.
答案1
明白了,夥計們!不用擔心!
我開始了解到 16.04 附帶 php 7.0 而不是 5.0。我的猜測是我為 apache 安裝了 php 5.0 模組。
安裝php7.0 apache模組:
sudo apt-get install libapache2-mod-php7.0
停用 php5 模組,因為我們沒有 php5.0:
sudo a2dismod php5
啟用 php7 模組:
sudo a2enmod php7.0
重新啟動阿帕契:
sudo service apache2 restart
就是這樣,夥計們