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 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屋!