How To – Activate PHP in public_html for Ubuntu 10

It seems it is a bug (I didn’t investigate too much) in Ubuntu 10.x related to PHP files in userdirs.

On my box I have Ubuntu 10.10, Apache/2.2.16 (Ubuntu) and PHP 5.3.3-1. Everything worked fine except the PHP files from ~userdir. Instead to parse these files, the web server send them directly to the browser which open the “save as” window.

The problem is in /etc/apache2/mods-enabled/php5.conf file.

<IfModule mod_userdir.c>
  <Directory /home/*/public_html>
     php_admin_value engine Off
  </Directory>
</IfModule>

These lines should be commented:

#<IfModule mod_userdir.c>
#  <Directory /home/*/public_html>
#     php_admin_value engine Off
#  </Directory>
#</IfModule>