What causes PHP pages to consistently download instead of running normally

Solution 1:

You might have only have the cli version of PHP installed currently try

sudo apt-get install php5

and restart apache

sudo apache2ctl restart.

You can also check the PHP module is loaded into apache by doing

sudo apache2ctl -M

Which if the module is loaded then it should show something like

Loaded Modules:
 ...
 php5_module (shared)
 ...
Syntax OK

Solution 2:

add this to your apache config

AddType application/x-httpd-php .php 

Solution 3:

You need to configure apache so that it will start the php interpreter when a .php file is requested instead of just returning the file's contents.

This needs to be done in httpd.conf for the directory in question. It would look something like this:

# Use for PHP 5.x:
LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php 

# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php

AddType text/html       php