Apache not displaying php pages, offering them for download instead

apache-2.2php5

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.

Thanks.

Peter.

Best Answer

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?