apache2返回PHP源而不是执行它

时间:2017-02-22 04:59:56

标签: apache2 raspbian php-7

我在覆盆子pi 3(运行raspbian jessie)上安装了apache2和php7,但是当我访问网页时,它返回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源而不是执行它。

1 个答案:

答案 0 :(得分:0)

关于你的apache安装的东西不太正确,试试这个:

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

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