tclogo



HotelsCombined.com

Pages

Archives

Categories


Recent Postings

Recent Comments

Feeds

RSS2 feed

Links

Most Popular Posts

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.

Tomas wrote on Friday, 22nd September 2006 5:49pm
Hi, People. I really like the site! Good job, nice logo... wealth of information on site and a nice design.
reply

Bouken wrote on Sunday, 29th October 2006 3:40pm
Thanks for linking to the PHP Snapshots page. I've been struggling with Apache 2.2 for a few hours now, looking around the net, and this just saved me some more time. Thanks for that.
reply

Wes wrote on Monday, 30th October 2006 7:14pm
If the info helped you and saved you a bit of time Bouken, then that's good to hear because that's the whole point of it.

Post a comment:

 

(required)

(required, but not published)

(optional)





Notify me of follow-up comments via e-mail

Megan wrote on Monday, 13th April 2009 10:46am
Thank you for this blurb...it got PHP working with Apache just like you said. :)
reply