May
10
2009

WAMP! Turn your computer into a web server

What is a web server?

When people think of web servers they might imagine something like a room full of gigantic computers. But the truth is that a web server is any computer that delivers web pages and files to the internet. So that means even your computer can be turned into a web server by installing server software and having an active internet connection. It is pretty cool to think that by installing some free software, you will be able to share stuff with people all over the world.

Why do I need a web server?

There are many reasons to have web server software installed on your computer.

  • Web developers often install a web server on their computer so they can use it as a testing ground for their projects. In most cases you can test simple HTML pages on your computer in editors like Dreamweaver or FrontPage, but you can’t test pages and applications that are built upon more complex languages like PHP, mySQL, or ASP without a web server.
  • Having a web server gives you a quick and easy way to share stuff with people. If you want to distribute a file of some sort to your friends or co-workers, you can load that file onto a temporary webpage where they can download or view the file after you send them a link to the page.
  • The most obvious reason to install server software is in order to host a website from your computer. The one problem with setting up a web server on your computer is that your computer must always be on and connected to the internet for your website to be online. But the great thing about web server software is that it does not need a powerful computer at all so you can take your 5 year old computer that is sitting in the basement, install WAMP, connect it to the internet, and you will have your very own personal web server. If you are serious about starting a website then you may want to consider renting space from a professional web hosting company (~100$/year) because they run their own servers that are guaranteed to be online 99.9% of the time. But if you just want to test things out, learn a bit about HTML, PHP, mySQL, and have some fun with server software then WAMP is a great way to get started. Did I mention its free!

What is WAMP?

WAMP is an acronym (Windows, Apache, MySQL, PHP) where Windows is the operating system it will run on and Apache, MySQL, PHP are the 3 components that are included with the installation. Apache is the actual web server software that allows others to view web pages and files served from your computer. Apache is by far the most popular web server software since it is open source. MySQL is one of the most commonly used web databases and is often used in conjunction with PHP which is a popular scripting language used to interface with databases and create powerful web applications. For example, this blog is programmed in PHP and stores information in a MySQL database.

So if you have decided to give WAMP a try, go ahead and download it here.

  • The equivalent installation on Linux is LAMP.
  • The equivalent installation on a Mac is MAMP.
  • The equivalent installation on Solaris is SAMP.
  • The equivalent installation on FreeBSD is FAMP.

Installation suggestions:

  • Install WAMP in the default location (C:\wamp) to avoid problems.
  • When you get to the “PHP and Parameters” screen, leave in the default values. You won’t need to change anything unless you are going to do some hardcore programming in PHP and you can do it later if needed.

When the installation is complete you should check to make sure everything is running smoothly. You can do this by left clicking on the WAMP server tray icon in the bottom right corner of your screen and selecting “Localhost”. This is the same as typing “http://localhost/” directly into your browser. If the WAMP server configuration page appears then Congratulations… you have successfully installed WAMP.

Now lets take a look at your WAMP directory under “C:\wamp”. You should see a subfolder named “www”. Within the “www” folder there is a set of files where one of the files is named “index.php”. A file with the prefix “index” like index.php or index.html is a special name on a web server because it is the file that is automatically displayed when a user first goes to a website. So when people go to “www.scottmulligan.ca” it looks around my main folder and finds “index.php” and automatically displays it as my home page for the site.

Setting up your first web page with WAMP

So if you want to display your own page when you access your server all you have to do is delete or rename the current file named “index.php” and create your own file named something like “index.html”. Lets try that out now.

  • After “index.php” has been renamed or deleted, open a text editor like notepad
  • Copy and paste the following code into the text editor

    <html>
    <head>
    <title>My First Web Page</title>
    </head>
    <body>
    Hello World Wide Web!
    </body>
    </html>

  • Save the file in “C:\wamp\www\” as “index.html”
  • Go to “http://localhost/” in your browser and it should say “Hello World Wide Web!”.
  • You can now change the page however you want

I have set up WAMP and it is not working?

The most common reason why WAMP will not working is because you already have another server software installed on your computer like Microsoft’s version called “ISS”. Since both types of server software are trying to access the internet over the same port this can lead to problems. You will need to disable or remove the other server software to get things working.

How do other people see your website over the internet?

You are able to access your homepage by typing “http://localhost/” into your browser, but this only works on your computer. For other people to access your homepage they will need to type your IP address into their browser once you have set your Wamp Server to online mode. For example lets say your IP address is “192.168.0.142″. People can type “http://192.168.0.142″ into their browsers and will be redirected to your site. You can quickly check your IP address on Windows by going to the command prompt and typing “ipconfig”.

One thing to keep in mind is that this works fine if you have a direct internet connection, but people may not be able to see your server if your internet connection runs through a router. Take a look at the video below for a brief example of how to setup your router to forward your server’s IP through the router.

What to do next…

If you want to take things a little bit further then you are not quite finished setting things up. The first problem that you will likely run into is that most internet providers assign dynamic IP addresses to people which means your IP address may not be the same as it was last week. This makes it hard for people to go to your site because you have to give them your new IP address whenever it changes. To get around this problem you should refer to the following video that describes how to assign a domain name to your site using DynDNS so people can remember the domain name instead of a changing IP address which is hard to remember.



Share/Save/Bookmark

Related posts:

  1. A Home Server for the Masses!
  2. 10 Minute Mail gives you a disposable email address
  3. Turn yourself into a WiFi finder
  4. Where do all those AVI vidoes come from?
    An AVI how-to overview
  5. Orb… Where have you been all my life?!

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

ScottMulligan.ca | Powered by WordPress | 2009