Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

ubuntu - php files are not executing but downloading

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...