Dec 29, 2010

Apache not parsing PHP

It happened to me more than once, and I keep googling it... Next time I know just the place with the solution :)
During my last apache update (which I did from webmin) all my php pages were not being parsed and as a result the browser asked me to download the .php file (with all the coding..).

Why does this happen?

Most likely the apache's php module is disabled (see Solution #1) or libapache2-mod-php is not installed (see Solution #2).

Solution #1

Enable apache's php module:
sudo a2enmod php5

Now restart apache:
sudo /etc/init.d/apache2 restart

Solution #2

(Re-)install php module:
sudo apt-get install libapache2-mod-php

Now repeat Solution #1.