PHP + userdir: Content-Type: application/x-httpd-php

This error has been seen on Debian and Ubuntu.

Problem

When accessing a page the browser ask you to download the page instead of showing it.

When looking at the content, it is the php-source.

Cause

The php module is not activated for the accessed PHP page. PHP might be accessible from other pages at the server though.

If you have installed userdir the config sometimes per default disabled PHP in the users directory, as in ~/public_html .

Solution

Look for the line php_admin_value engine Off in /etc/apache2/mods-available/php5.conf or /etc/apache2/mods-available/userdir.conf and uncomment that line.

This problem is related to package apache2.2-common and libapache2-mod-php5.


Powered by: Linux, Apache, PHP, Hans Schou