Sunday, January 29, 2012

setting up PHP (5.3.9) with apache (2.2.21) on windows

I was trying to configure the apache server to load php module from last 2 days. The web server was running fine unless i add that LoadModule statement.
LoadModule for php5_module I was using in httpd.conf file to load php module:


LoadModule php5_module "C:/php/php5apache2_2.dll"
AddHandler application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"


So I searched all over the net to find nothing which will solve my problem.

Finally, when i start the server from command line (command below), I saw that the module cannot be loaded because the server cannot locate the php directory and the dll file.
Command to run apache server from cmd line in debug mode:
httpd.exe -e debug

So the solution was so simple:
use the \ instead of /. All over the web i saw that u need to use the forward slash but actually it worked when i used the backslash.

Note: I also downloaded the linux zip of php when i first did it. Then came to know about this link which worked great to know which file u exactly need to download.
http://windows.php.net/

Labels: