Re: [Hampshire] Apache2 configuration

Top Page

Reply to this message
Author: Graeme Hilton
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Apache2 configuration
john lewis wrote:
> still can't get it to display index.php so am giving up for today
> and will try again tomorrow when brain is less fuzzy


You need to tell Apache how to handle the .php files. This is done with
the following incantion:
AddHandler php5-script .php
AddType text/html .php

You also need to tell it that index.php is the file you want it to serve
if you give it a url without a filename on the end (i.e.
http://www.example.com/). This is done with the DirectoryIndex statement
DirectoryIndex index.php

On my FC6 system all these php specific parts are in
/etc/httpd/conf.d/php.conf which I've copied below.

Hope this helps.

--
Graeme

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php5_module modules/libphp5.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps