| < Previous | Index | Next > |
1) So far we've been using the domain name sandbox.dev through-out this guide. Obviously this domain won't actually resolve, but it is easy to make Windows think otherwise by editing what is know as the hosts file. There are two ways to do this, one via Notepad and one by using the Host Administrator utility, a great piece of freeware by Rekenwonder Software. We'll cover both:
2.1) Run the Host Administrator utility (hostadm.exe)

2.2) Click Add. The Add new host window will appear:

2.3) . Enter the following:
IP address: 127.0.0.1
Host Name: sandbox.dev
Alias: leave this empty

2.4) Click OK and the domain will appear on the list.
2.5) Repeat this process again but this time enter www.sandbox.dev as the Host Name.

2.6) Click the Save button.
2.7) Click Exit.
This process just updated your Windows hosts file by adding the domain sandbox.dev and pointing that to the IP address 127.0.0.1, which is the address of your local PC running Apache. Windows first scans the hosts file for domain names before doing a DNS look-up. This means when you enter sandbox.dev into a web browser Windows will look into the hosts file and see that it should connect to 127.0.0.1. Using this technique and the Apache Virtual Hosts file we can host many different domains on our local PC for development.
If you'd rather edit your hosts file manually then this is how to do it:
3.1) Using Windows Explorer navigate to: C:\WINDOWS\system32\drivers\etc (if Windows is installed elsewhere then change the path accordingly)

3.2) Open the file hosts into Notepad.
3.3) Add two new lines to the file:
127.0.0.1 sandbox.dev 127.0.0.1 www.sandbox.dev

3.4) Save the file. Make sure Notepad doesn't automatically add the .txt extension to the file. It should just be called hosts, with nothing else in the name.
4) You can test your new domain name by opening up your web browser and typing in http://www.sandbox.dev - at this point in time it will show you the default Apache 'It works!' page.

We're now ready to get our first PHP site running.
| < Previous | Index | Next > |
|
Need help? Post in the WAMP Guide Forum! © Copyright 2007 - 2008 Richard Davey |