Core PHP
Apache 2, PHP 4 & PHP 5 on Windows XP
Core PHP
Blog: CorePHP Blog     Current Projects: PHP on XP Guide  —  NFO Viewer  —  Easy Reflections  —  HotWire  —  FileGlider
< Previous Index Next >

Step 9 - httpd.conf

1) Using Windows Explorer navigate into the folder: C:\Program Files\Apache Software Foundation\Apache2.2\conf.

2) Open the file httpd.conf into a text editor (Notepad will work just fine.)

3) Scroll through the file until you hit the block with lots of LoadModule commands. They start on line 67.

4) Find the line that says:

#LoadModule rewrite_module modules/mod_rewrite.so

5) Remove the # from the start of the line (effectively un-commenting it). This will enable Mod Rewrite, useful for PHP frameworks such as CakePHP and the Zend Framework.

6) After the last LoadModule line (which should be the ssl_module) paste in the following block of text:

# PHP4
LoadModule php4_module "C:/php/php-4.4.7-Win32/php4apache2.dll"
PHPIniDir "C:/php/php-4.4.7-Win32"

# PHP5
#LoadModule php5_module "c:/php/php-5.2.3-Win32/php5apache2_2.dll"
#PHPIniDir "C:/php/php-5.2.3-Win32"

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

This will tell Apache to use PHP 4. At the moment PHP 5 is commented out, but we'll enable it later on. The file should now look like this:


The image above shows PHP 5.2.2, yours will show 5.2.3

7) Carry on scrolling down the file until you get to this block of text:

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

Change it to:

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

We've added index.php to the recognised list of 'index' pages for a web site. The files are searched for in the order in which they appear on the DirectoryIndex line, meaning that Apache will look for an index.php first, and if not found, it'll look for index.html next.

8) Finally scroll to almost the very bottom of the file where you will find these two lines:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Remove the # from the Include line so it looks like this:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

9) Save the httpd.conf file.

< Previous Index Next >

Need help? Post in the WAMP Guide Forum!

© Copyright 2007 - 2008 Richard Davey