OS and server information:
I previously had php 5.3.x installed but decided to upgr
I came across this issue today and none of the solutions described worked for me. So here is another possible cause:
If you have something like
AddHandler x-mapp-php6 .php3 .php4 .php .phtml
in a .htaccess
file of your web content folder, it can cause your PHP scripts to stop working. In my case the server did not know the x-mapp-php6
type, since that .htaccess
file was something I imported from a different web host when I transferred the website content.
Just removing the AddHandler
line from the .htaccess
file solved it for me.
It's also possible that you have nginx running but your php is set up to run with apache. To verify, run service nginx status
and service apache2 status
to see which is running. In the case that nginx is running and apache is not, just run sudo service nginx stop; sudo service apache2 start
and your server will now serve php files as expected.
Ok... I know that there are 1.000.000 answers to this questions already, - but I have spent at least 6 effective hours, figuring this one out; and I have googled it hundreds of times and not found a single post about it. So I figured that I would add the solution to my problem here.
If I commented these two lines out in my .conf-files in the /etc/apache2/[[SERVER-NAME].conf
-file:
php_admin_value engine Off
IPCComTimeout 31
I have no idea what they do or how they got there, - but it is in every one of my .conf
-files. And if I remove those lines and ensure that there is a symlink in /etc/apache2/sites-enabled/
-folder, then it doesn't download the index.php - and every works as it should.
I have VirtualMin installed on an Ubuntu 16.04 VPS. I upgraded to PHP version 7.2. Shortly after that, I updated the Ubuntu-version and struck a 'Kernel Offset: Disabled'-error. So I had to go delete the latest Ubuntu-version, - and when my OS booted up again: BOOM! I got the error that his post talks about: For every site on my VPS, it simply downloaded the index.php instead of showing it.
I tried all kinds of stuff:
a2enmod [MODULE_NAME]
. And I found the module name by Googling around. I had to active about 6-8 modules, before I got past that step in the validation - and it took a couple of minutes before the cache ran out, - so doing this was a tedious step.This might be happening due to the missing modules required for your php. Assuming you have php7 installed, search available php7 modules using
sudo apt-cache search php7-*
Above command will list all available PHP7 modules for installation. You can begin installation of modules like,
sudo apt-get install libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json
If Your .htaccess have anything like this
AddType application/x-httpd-ea-php56 .php .php5 .phtm .html .htm
this solved the problem for me (I have php7 installed):
sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart