Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php 7 file is downloaded instead instead of executing [duplicate]

I recently configured php7 on Ubuntu 14.04 by following blog http://www.zimuel.it/install-php-7 and I installed it successfully as per blog. but when try to run the php file (/var/www/test.php) then it is downloaded instead of executing. I have no idea what configuration I missed. and when I entered localhost in browser then it comes with response "it works".

like image 572
sameer.nuna Avatar asked Sep 25 '22 23:09

sameer.nuna


2 Answers

(Edit) I had a similar problem that first looked like that Apache randomly showed me correct data and sometimes gave me a download option. It showed up that it was completely different processes that competed about answering to port 80. Killing everything alive fixed that problem and this has actually very little to do with the real problem. So the rows below actually solved the download-problem for me, at last.

LoadModule php7_module        modules/libphp7.so
AddHandler php7-script .php
AddType application/x-httpd-php-source .phps
AddHandler application/x-httpd-php .phps
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php
like image 99
Tomas Tornevall Avatar answered Oct 11 '22 14:10

Tomas Tornevall


In your apache configuration in /etc/apache2/sites-available try to remove this lines with comments:

#RemoveHandler .php
#RemoveHandler .php7.0
#php_admin_value engine Off
like image 21
TomoMiha Avatar answered Oct 11 '22 13:10

TomoMiha