php files are not executing but downloading

送分小仙女□ 提交于 2019-12-12 07:02:59

问题


I am trying to configure LAMP in my Ubuntu 15.10 Desktop with PHP 7.0, Apache2, and MySQL.

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.


回答1:


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.

First, in your httpd.conf file, look for: "LoadModule mpm_event_module modules/mod_mpm_event.so" and COMMENT that out.

The next line "#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so" should be UNCOMMENTED.

Then, add this include at the end of the file: "Include conf/extra/php7_module.conf"

Restart Apache and you should be up and running.



来源:https://stackoverflow.com/questions/34536992/php-files-are-not-executing-but-downloading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!