How To Configure PHP 5 With Apache 2 On Windows in 2 Minutes
By Angsuman Chakraborty, Gaea News NetworkMonday, September 25, 2006
I am assuming that you have downloaded and installed Apache 2.x on your windows machine. Use the latest version 2.2, if you do not have plans to run Subversion on it. Otherwise choose Apache 2.0.x. Install it with the defaults. You may want to however changes the drive on which it is installed. Anyway so you have it running. Then you went to php.net and have downloaded and extracted the zip file to say c:\ or d:\. I am assuming you have then changed the name of php.ini-recommended to php.ini. So far all the steps are straight forward and their install guide is good enough. Now you are feeling happy about it and want to integrate PHP with Apache, right? That’s when the fun begins.
To cut the long story short the instructions in PHP document doesn’t work and have obviously not been updated in a long while. So I will give you a 2 minute guide to glory.
Open httpd.conf (in Drive:\Program Files\Apache Group\Apache2\conf) and search for LoadModule statements. At the end add:
LoadModule php5_module "D:/php/php5apache2.dll"
Then search for
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Note: The last AddType is a nicety. It allows you to view .phps files (php files with extension renamed) in htmlized and colorful format from your browser.
Now restart the server.
Did I say you are done? Well, you are. So go out and enjoy.
Note: If you are a wimp and you don’t need Subversion you may take the easy way out and install Xampp instead. It will do the dirty work for you.
Tags: Dirty work
May 31, 2010: 2:22 pm
Got over here in search of php config for apache proc… Followed the steps above and made my day.. |
Lars |
May 27, 2010: 11:24 am
One thing to note: When downloading php, pick the one compiled with VC6 (which is stated) and the zip file, NOT THE WINDOWS INSTALLER. The windows installer DOES NOT CONTAIN the php5apache2.dll, but THE ZIP FILE DOES. |
Stuart |
December 9, 2009: 5:36 am
Thanks so much for this, the instructions on php.net are pretty terrible and this solved my problem. However, in the version of php5 I have, there is no php5apache2.dll, it is called php5apache2_2.dll, just thought I’d mention it. |
zedu |
November 11, 2009: 1:26 pm
thanks,its awesome it worked for me on windows xp,but the smae works on windows server 2003…please replyy mee…its very urgent |
Ben |
September 10, 2009: 6:03 am
Thanks, worked a treat! As mentioned below, make sure you use php5apache2_2.dll if using php5.3 and apache 2.2 though. |
umer ahmad |
September 1, 2009: 1:48 pm
hello..i am having problem integrating PHP 5 with my Apache server 2.2..i have followed the above stated step but when i try to open a php(notepad file with .php extension) file from explorer(firefox) even after placing it in the htdocs folder in the Apache installation..the explorer gives and error The requested URL /phpinfo.php was not found on this server…plzz help me…and tell me whats wrong here |
Nick |
July 18, 2009: 4:43 pm
This does not work because when you restart the server it does not restart. These instructions aren’t very clear. This has mucked up my whole website. I suggest you do not use |
Vineet Maheshwari |
April 10, 2009: 4:14 pm
It is missing one trivial addition of index.php addition to the httpd.conf file. this was not allowing my apache to auto load index.php |
Pete A |
January 16, 2009: 9:44 pm
I recently installed apache and php on a Windows XP box and had the same error message ‘The Specified Module Could not be found’ as the above post. My problem (and its solution) was due to the fact that I installed version 2.2 of Apache and had the line LoadModule php5_module “D:/php/php5apache2.dll” in my conf file. I changed this to LoadModule php5_module “C:/PHP/php5apache2_2.dll” and the problem was sorted. The PHP install package includes this file - php5apache2_2.dll - as part of the download so you should already have it in your c:/php (or wherever you put php) folder. |
May 31, 2008: 7:17 am
Hi Well done I have follow you instructions but I get an error: My OS is Vista home premium. (Here is a good link to find that missing php5apache2.dll This is the code lines from my httpd.conf Then right bellow I have placed the 3 lines as you instructed: LoadModule php5_module “php/php5apache2.dll” Please advice Thanks for your help |
Peter |
February 24, 2008: 9:39 pm
Thanks, That worked well. |
Lok |
December 18, 2007: 10:50 am
Awesome, thanks! this was the critical part I needed. Even book installation procedures were off base |
rami |
October 14, 2007: 11:28 pm
hi |
Anonymous |
Anup