How To Configure PHP 5 With Apache 2 On Windows in 2 Minutes
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.
Filed under Headline News, How To, Open Source Software, PHP, Tech Note, Web, Web Hosting, Web Services, Windows |
|
RSS 2.0 |
Trackback this Article
|
Email this Article
You may also like to read |





































September 22nd, 2007 at 4:16 am
Thank U very much..
October 14th, 2007 at 11:28 pm
hi
does this config works on vista?
i download the latest php, but font contian the php5apache2.dll but i have the php5ts, can any1 tell me what to do..please
December 18th, 2007 at 10:50 am
Awesome, thanks! this was the critical part I needed. Even book installation procedures were off base
February 24th, 2008 at 9:39 pm
Thanks,
That worked well.
Extra step to smooth things in Vista
I would add that in the htdocs folder (for those lazy folks who don\’t change the root directory to be something else), that changing the permission ability for USER makes it really simple to add/edit files
go to htdocs directory
right click and select \”Customize This Folder\”
select \”Security\” tab.
select \”Edit\” or \”Advanced\” to change the permissions for USER
May 31st, 2008 at 7:17 am
Hi
Thanks for the info
Short and good.
Well done
I have follow you instructions but I get an error:
The specified module could not be found.
My OS is Vista home premium.
Must say that the file: php5apache2.dll
was not part of the PHP package.
instead, I have: php5ts.dll
(Here is a good link to find that missing php5apache2.dll
http://kromann.info/download.php?strFolder=php5_1-Release_TS&strIndex=PHP5_1
)
This is the code lines from my httpd.conf
I have placed the lines at the end of the LoadModule list.
This line is the last one on the list:
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
Then right bellow I have placed the 3 lines as you instructed:
LoadModule php5_module “php/php5apache2.dll”
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Please advice
Thanks for your help
Amit C.