Take the 2-minute tour ×

we are trying to setup apache (apache 2 in this case, although apache does the same thing) and html pages display just fine, however, any php pages linked into buttons on the front page are offered for download rather than being displayed.

Any ideas what we have missed? Its proving difficult to search on this in google as the terms are so heavily used elsewhere.

I know this is a bit general, but we have tried adding types to the to the apache.conf (or httpd.conf for apache1) are having no joy at all.



share|improve this question

3 Answers 3

up vote 3 down vote accepted

You're missing a PHP script handler.

The configuration lines in Apache2 that you're missing look something like this:

# Use for PHP 5.x:
LoadModule php5_module        modules/libphp5.so
AddHandler php5-script php 

# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php

With something like Apache on Linux, it's typically installed when you include the PHP packages into your distribution.

What OS are you running this on?

share|improve this answer
also, don't forget to restart your apache server after making changes to the configuration. simply adding the types and letting it go isn't enough. only mentioning this as the OP mentioned adding the types to his configuration. –  cpbills May 12 '10 at 18:56
OK.. no joy on this one. The setup I have is loading the php module and handler in a file from mods-enabled which has the configuration mentioned above, but still, after restarting the server, I'm getting the same behavior. This is running on a Ubuntu installation. Peter. –  Peter NUnn May 13 '10 at 0:58
Turns out that a re-install did the trick. No idea why, the configs seem to be the same, but its all good now. Thanks all. –  Peter NUnn May 13 '10 at 10:06
Also, don't forget to clear your browser's cache. –  Vargas Dec 20 '11 at 12:42

You could also try this

a2enmod php5

then restart apache2 with

rcapache2 graceful

on a suse style linux

share|improve this answer
the a2enmod command comes back with "This module is already enabled!" and I have no rcapache2 (but I guess /etc/init.d/apache2 restart is the same). –  Peter NUnn May 13 '10 at 1:00

I was looking on this question for a while finding a lot of Linux answers and not too many Windows answers.

Here was the solution for me:

If you already put the AddType application/x-httpd-php .php into the httpd.conf file for Apache, then you do not need it in your .htaccess file on your webpage. I found deleting it from my .htaccess made php render.

share|improve this answer

Your Answer


