Check that php is installed properly.

In most of the cases, the following should work:

apt-get install libapache2-mod-php5
service apache2 restart

a2endmod may not be necessary.

When you install┬álibapache2-mod-php5, you’ll notice that it will restart apache2 itself. Still, you need to execute the second and third commands before php actually works.

If you need a full installation, the following commands should be executed first:

apt-get -y install php5 php5-cli php5-curl php5-dev php5-gd php5-mcrypt php5-mysql php-pear