How to Host a Website Using WAMP (Using Windows)

How to Host a Website Using WAMP (Using Windows)

How to install WAMP

There are quite a few different WAMP programs available, but for the purpose of this guide, we’re going to use WampServer which is completely free to download.

downloads
  1. Make sure you download the latest version of WampServer
  2. Select download and start the installation
  3. Navigate through the installation steps, keeping all of the default settings where prompted

Bear in mind that WAMP Server is quite a large program, so it may take some time to install and extract the necessary files:

wamp setup

You’ll be prompted to choose your default browser which WAMP will automatically locate for you:

iexplore.exe

If you want to choose another browser, click ‘Yes’ and locate it on your PC. The same prompt will apply for your default Text Editor which usually defaults to Notepad (again, you can change this if you want to).

file manager

You may be asked by Windows whether or not you want to allow Apache through your Windows Firewall; make sure you add a security exception for Apache via your private and public networks:

windows firewall

How to use WAMP

Once you’ve installed WAMP, a directory on your computer will have been created; this will most likely (if you didn’t change the default settings) be located at c:\wamp\www

After you’ve located your WAMP directory, you can create sub-directories, such as, Projects, which can contain HTML or PHP files within them.

Once you’ve launched WampServer, click on the icon in your system tray by left clicking on it to bring up the following menu:

wamp

Select ‘Localhost’ – this will launch a webpage in your chosen internet browser which looks like this:

wamp configuration

You can also navigate directly to this page by typing in the following into any web browser: http://localhost/

How to create a HTML/PHP page

Now that WampServer has been installed, and it runs correctly, we can test it out! Using the same menu (by clicking on the WampServer icon in your system tray), select ‘www directory’ like this:

wamp

Using your text editor, create a new file and enter the following line of code, save the file in the www directory, and ensure the file extension is .php:

<title>PHP Test</title>

info.php

Navigate to the page you’ve just created by inputting the following into your browser (http://localhost/info.php) which should look something like this:

localhost

You can then repeat the steps above to create any HTML or PHP document within your www directory – pretty cool right?

How to configure MySQL

If your website relies on databases, you’ll need to configure your MySQL database. If you’re using WordPress or a similar CMS platform to create your website, then the databases should all be automatically set up for you.

Click on the WampServer icon in your system tray and select the ‘phpMyAdmin’ option which will open in a new browser window for you:

wamp

The default username should be root and the password field can be left blank unless you wish to change it. Once you’ve logged in, you’ll then have access to create new databases and change existing databases as/when you need to:

phpmyadmin

Making your website public (live)

Once you’ve created your website and setup your databases, you’re going to want to make it live so that the world can see it.

Go back to the WampServer menu and select ‘Apache’:

wamp

You’ll need to change the configuration settings to make your website public, as by default, they are set to private. Locate the Apache configuration file (httpd.conf), right click on it, and edit with your text editor.

Change the existing settings which should look like this:

query 1

And amend them to look like this:

query 2

Once you’ve performed the above steps, go back to the WampServer menu and select ‘Restart All Services’.



Leave a Reply

Your email address will not be published.

*
*
*