So I've installed LAMP on an Ubuntu machine for some php development and everything is working fine except instead of parsing and displaying php pages, the browser is asking me if I want to download them. I know this is a well documented issue, and I've already been to the Ubuntu page concerning it, and gone through all the potential causes. I've installed
sudo a2enmod php5
module php5 already enabled
So I figured this out with some really tedious searching, I'm surprised the solution is not more widely available, it's really very simple. The
/etc/apache2/mods-available/php5.conf file comes with these lines.....
8 # To re-enable php in user directories comment the following lines 9 # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it 10 # prevents .htaccess files from disabling it. 11 <IfModule mod_userdir.c> 12 <Directory /home/*/public_html> 13 php_admin_value engine Off 14 </Directory> 15 </IfModule>
...which obviously disable php in user directories. These need to be commented out.