apache2返回PHP源代码而不是执行它

apache2返回PHP源代码而不是执行它,apache2,raspbian,php-7,Apache2,Raspbian,Php 7,我在raspberry pi 3(运行raspbian jessie)上安装了apache2和php7,但是当我访问网页时,它返回php源代码而不是执行它 PHP7似乎安装正确 $ 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 Technolo

我在raspberry pi 3(运行raspbian jessie)上安装了apache2和php7,但是当我访问网页时,它返回php源代码而不是执行它

PHP7似乎安装正确

$ 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
时,我得到
错误:模块php7.0不存在

当我尝试安装它时(
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源代码而不是执行它。

您的apache安装有些不太正确,请尝试以下方法:

apt-get install -f
apt-get update
apt-get dist-upgrade

如果这不起作用,我建议尝试
apt-get-remove-apache2

是否运行sudo-apt-get-update和sudo-apt-get-upgrade?我有。我还尝试了
apt-get-dist-upgrade
,并添加了
debhttp://mirrordirector.raspbian.org/raspbian/ 将主contrib非自由rpi
拉伸到我的源列表(
/etc/apt/sources.list
)。