As a web developer many want to test their developments on their local machines. But when it comes to dealing with PHP and MySQL you will need a web server (software) to test the sites you make. Normally we would have to download Apache from www.apache.org , MySQL from MySQL.net and configure these separately to work with each other on our local machine. Also if you want to administer MySQL on the browser you will have to install PHPMyAdmin which is a burden for the novice user.
To tackle these problems there are several packaged solutions on the net. Popular and more robust one is WAMP server. www.wampserver.com .
Let see step by step on how to create a root folder for our new web site that has to be built using PHP.
Step 1: Easiest way!
After installing WAMP on your local machine (You should see a white Speedo meter on the notification area) goes the folder where WAMP resides (If you install it on you C: partition then it is C:/wamp/). The folder structure is as follows,
Go inside the www folder and create a new folder inside it called "TestSite". This is the rot folder of your web site. Better if you do not put spaces. Open up a simple notepad document and insert the following on it (don't copy the formatting. Just type it),
| <?php echo "Hello World!"; ?>
Then same it inside the newly created folder and name it index.php.
Go to your browser and call http://localhost/TestSite/
If you see something like this then you are ready to do building rest of your dynamic web site.
Step2: Assigning a root folder outside "www".
Well, if we want separate our web site folders from the WAMP server folder and put somewhere else in the hard drive then procedure gets a bit tricky for the beginners.
First create the folder you want as the web site root folder. Let's say D:/MyNewTest/
Now we have to tell the WAMP server that this folder contains a web site and it should come up when the URL is called through the browser right?
Ok, first click on the little Speedometer icon on the notification area. Then go to,
Apache > Alias directories > Add an alias
Then you will be asked to give an alias to the site, this is what you type after http://localhost/ in the browser. Previous one was "TestSite" which is actually the folder name itself. But this is not necessary in this case. You can put anything. But don't use spaces or dots. J
Let's put "MySite".
Then you will be asked what is the actual folder that MySite alias point to.
Give the following, D:/MyNewTest/
Note the forward slashes.
Now press enter to close the DOS prompt.
Go to your browser and type the http://localhost/MySite/
You will see the root index now. Put the notepad file we created earlier to "D:/MyNewTest"and refresh the browser page to test the PHP.
That is it. Simple isn't it?