Enable PHP in per user web directories for Ubuntu 12.04
I spent a whole day trying to find out how to fix this.
PHP was working fine under /var/www but when I enabled the userdir module and then access /~user/something.php it was downloading the file instead of executing it.
1. # sudo vim /etc/apache2/mods-enabled/php5.conf
2. comment the line php_admin_value engine Off
I found this solution here: http://matthewwittering.co.uk/blog/ubuntu-tips/apache-not-running-php-files.htm