问题
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