php文件没有执行而是下载 [英] php files are not executing but downloading
问题描述
我正在尝试使用 PHP 7.0、Apache2 和 MySQL 在我的 Ubuntu 15.10 桌面中配置 LAMP.
I am trying to configure LAMP in my Ubuntu 15.10 Desktop with PHP 7.0, Apache2, and MySQL.
似乎一切正常,但是当我尝试通过将其放在路径 (/var/www/html
) 上来执行任何 php 文件时,该文件会被下载.
Everything seems to be working but when i try to execute any php file by putting it on path (/var/www/html
), the file gets downloaded.
以下是已经查找并尝试过的命令,但我无法使其工作.
Below are the commands which are already looked up and tried, but I couldn't get it to work.
sudo apt-get install php7.0
sudo apt-get install libapache2-mod-php7.0
sudo a2enmod php7.0
sudo service apache2 restart
我错过了什么吗?请让我知道任何建议或建议将不胜感激.
Am I missing anything? Please let me know any suggestions or advice will be very appreciated.
推荐答案
我不知道这是否是特定于发行版的,但是(假设您使用的是 Apache 2.4)您可能会研究一些额外的步骤.
I don't know if this is distro specific, but (assuming you are using Apache 2.4) there are some additional steps you might look into.
首先,在您的 httpd.conf 文件中,查找:LoadModule mpm_event_module modules/mod_mpm_event.so"并注释掉.
First, in your httpd.conf file, look for: "LoadModule mpm_event_module modules/mod_mpm_event.so" and COMMENT that out.
下一行#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so"应该是未注释的.
The next line "#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so" should be UNCOMMENTED.
然后,在文件末尾添加这个include:Include conf/extra/php7_module.conf"
Then, add this include at the end of the file: "Include conf/extra/php7_module.conf"
重新启动 Apache,您应该可以正常运行了.
Restart Apache and you should be up and running.
这篇关于php文件没有执行而是下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!