Tuesday, June 06, 2006

Configuring Apache - PHP - MySQL on Windows (WAMP Configuration)

[Download and Install]
1Download Apache, PHP, MySQL
2Install Apache to its default location and make sure IIS is stopped during installation.
3Extract PHP to C:\PHP folder
4Install MySQL
5Create a folder C:\MyWebsite (This is the folder where you want your website to be)



[Setup php.ini]
1Goto C:\PHP folder and rename php.ini-dist to php.ini and open this file.
2Search for "doc_root =" or goto line# 454 and change this to doc_root = "C:\MyWebsite\"
3Goto Line# 461 and change this to extension_dir = "C:\PHP\ext"
4Goto Line# 598 and change it to extension=php_mysql.dll



[Setup httpd.conf]
1Open C:\Program Files\Apache Group\Apache2\conf\httpd.conf file
2Goto Line# 120, change this to Listen 8080
3Goto Line# 228 and change it to DocumentRoot "C:/MyWebsite"
4Goto Line# 238 and change it to <Directory "C:/php">
5Goto Line# 321 and change it to DirectoryIndex index.html index.html.var index.php index.htm
6Goto Line# 515 and remove the default ScriptAlias paste the following.
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php .php5
Action application/x-httpd-php "/php/php-cgi.exe"
SetEnv PHPRC "C:/php"


[Testing Your Configuration]
1Goto C:\MyWebsite and create a file index.php
2Open the file and paste this code and save it. <?PHP phpinfo(); ?>
3Open your browser and type http://localhost:8080/
4You should see the complete details of your PHP setup otherwise recheck your configuration.
Bookmark and Share

15 Comments:

Anonymous David said...

Excellent tutorial

June 08, 2006 1:17 PM  
Anonymous Cramez said...

I was trying too hard to configure this. Nice tutorial!

June 09, 2006 9:51 AM  
Anonymous cramez said...

digg your site @ http://digg.com/programming/2_minutes_-_WAMP_Configuration_(Windows_-_Apache_-_MySQL_-_PHP)
I added it so that it can help others too!

June 09, 2006 11:04 AM  
Anonymous Anonymous said...

Nice tutorial....

Where is the code for the index.php??? Am I missing something here?

June 10, 2006 2:28 AM  
Blogger Deepak Radhakrishnan said...

Code for index.php added

June 13, 2006 12:31 PM  
Anonymous Seraph said...

I followed the instructions, but am getting the following 'Forbidden' error. Any ideas?

You don't have permission to access /php/php-cgi.exe/index.php on this server.

June 14, 2006 7:40 PM  
Blogger Deepak Radhakrishnan said...

To get rid of the 403 forbidden error: change security settings in the httpd.conf by removing the lines "Order allow,deny" and " Allow from all" in the Directory-tag, which is located just below Documentroot.

June 14, 2006 8:43 PM  
Anonymous Anonymous said...

In the section, [Setup httpd.conf], it reads:
1 ...
2 ...
3 ...
4 Goto Line# 238 and change it to
5 ...

Change Line# 238 to what?
Otherwise, an excellent tutorial...

June 25, 2006 11:29 PM  
Anonymous Anonymous said...

Will this tutorial work for Apache 2.2.2 and PHP 5.1.4? Thanks.

July 01, 2006 12:13 AM  
Blogger Deepak Radhakrishnan said...

Ya. It'll work for Apache 2.2.2 and PHP 5.1.4
Just that the line numbers may change

July 01, 2006 3:12 PM  
Anonymous Anonymous said...

Thanks for the post about the security settings. I was completely getting crazy of that Forbidden-error!

July 05, 2006 3:42 AM  
Anonymous Anonymous said...

For Apache 2.2

Directory /
Options FollowSymLinks
AllowOverride None
# Order deny,allow
# Deny from all
Satisfy all
/Directory

Saludos

July 21, 2006 4:13 PM  
Anonymous Anonymous said...

I followed the instructions but with me when I type http://localhost:8080 it ask if I want to save localhost.

what went wrong?

July 22, 2006 2:18 AM  
Anonymous Anonymous said...

Just install WAMP Server. All in one pack. Download and run the setup.
Link is here: http://www.wampserver.com/en/download.php

July 20, 2007 9:57 AM  
Blogger Sage said...

damn we need captcha on here...

June 30, 2008 11:56 PM  

Post a Comment

Links to this post:

Create a Link