tclogo



HotelsCombined.com

Pages

Archives

Categories


Recent Postings

Recent Comments

Feeds

RSS2 feed

Links

Most Popular Posts

Recent Posting

Getting Apache 2.2 to work with PHP 5

Saturday, 20th May 2006 6:50am
I decided to install Apache 2.2 and also upgrade my PHP 5 and I thought it would be a straightforward process but in the end it wasn't for reasons I am going to explain below. I am not going to write a whole tutorial on installing Apache and PHP 5 because there are already some excellent tutorials around and the one from this site I found it to be very good.


What I will do though is to highlight the small changes I made to make Apache 2.2 work with PHP 5.


Assuming PHP is installed in the C:/php folder normally you would add the following lines to your Apache httpd.conf file:


LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# configure the path to php.ini
PHPIniDir "C:/php"


With Apache 2.2 I got an error on the LoadModule line. To resolve that error I had to download the latest stable release of PHP from the PHP Snapshots site. I downloaded the zip file for PHP 5.2 and this comes with the php5apache2_2.dll file.


In the Apache httpd conf file I then made changes to the LoadModule line as follows:


LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# configure the path to php.ini
PHPIniDir "C:/php"


and this solved the problem. I prefer using the PHPIniDir directive because this means I just maintain one copy of the php.ini file in C:/php folder in this case and I don't have to copy another one to C:/Windows for example and this works fine for me.

delicious delicious | digg digg

Category: Php | Comments : 4