0
我在樹莓派3(運行raspbian jessie)上安裝了apache2和php7,但是當我訪問一個網頁時,它會返回php源代碼而不是執行它。apache2返回PHP源代碼而不是執行它
PHP 7似乎被正確安裝...
$ php -v
PHP 7.0.15-1 (cli) (built: Jan 25 2017 10:17:41) (NTS)
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.15-1, Copyright (c) 1999-2017, by Zend Technologies
但是當我運行sudo的a2enmod php7.0
我得到ERROR: Module php7.0 does not exist!
。
當我嘗試安裝它(sudo apt-get install libapache2-mod-php7.0
),我得到這個問題:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-php7.0 : Depends: apache2-bin (>= 2.4.16) but 2.4.10-10+deb8u7 is to be installed
E: Unable to correct problems, you have held broken packages.
我試着重新安裝的Apache2,但似乎沒有任何工作。網頁仍然會返回php源代碼而不是執行它。
你有沒有執行sudo apt-get的更新和須藤apt-get升級? –
我有。我也嘗試過'apt-get dist-upgrade',並在源列表中添加了'deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi'('/ etc/apt/sources。 list')。 – chipit24