我在Debian Wheezy上使用sudo apt-get install php
安装了php。这样就安装了Apache,并创建了一个名为/var/www/index.php
的文件。
然而,当我在浏览器打开localhost/index.php
时,该文件显示为纯文本。有趣的是,我在Ubuntu上也试过同样的东西,它可以开箱运行,所以Debian和Ubuntu在这里有一些不同。
在Debian上安装apache后,需要重新启动apache。所以在安装php时,你可以这样做:
sudo apt-get install php5
sudo /etc/init.d/apache2 restart