HomeApache Page 5 - Installing and Configuring Apache 2 on a Windows XP Machine
Configuring MySql - Apache
Apache 2 represents quite a change from previous versions. If you have set up a previous version of Apache on a Windows XP PC, you will be interested in setting up the new version. Dan Wellman shows how to set up and configure Apache 2 on a Windows XP PC to give you a development environment that will allow you to test your PHP and other dynamic web technologies before taking them live.
All that remains is to install and configure MySql. This is probably the trickiest part and involves several steps for success. First, download the MySql 4.1 installer for Windows from www.mysql.com and run it. Accept all the defaults and use localhost for the server name. A guest account will work, but will not be as secure as one with a password.
Once MySql is installed, go to the System control panel applet, select the Advanced tab and click the Environment Variables button. Highlight the Path variable and select the Edit button. Go the very end of the line and add ;C:\php then click OK.
You’ll need to restart the machine at this point. Now go to the find files option in the start menu and do a search for libmysql.dll,then copy this file to your default PHP location (C:\php). Now go back to the find files window, do a search for php.ini and open the file found in Notepad. Scroll down until you find ;extension=php_mysql.dll and remove the semi-colon from the beginning of the line. Save this file and restart Apache. This should work fine, but if you get an error message saying that the libmysql.dll file could not be found, try copying this file to the Apache Bin folder as well.
To test MySql, open Notepad and type the following:
$dbServer='localhost'; $dbUser='root'; $dbPass=' '; $dbName='test'; $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die ("Could not connect");
print "Connected successfully<br>"; mysql_select_db("$dbName") or die("Could not select database"); print "Database selected successfully<br>";
This will simply attempt to connect to the server and select the test database that is created during the MySql installation. Save this file as mysql.php in your web site folder then open a browser and type http://localhost/mysql.php. You should see a web page displaying:
Your WAMP installation is now complete. You should now be all set to begin creating and testing complex database driven, dynamic web sites. Please note that the set up described in this article is for closed, development environments only. This configuration is in no way secure and should not be used for production.