how to install A-M-P on W with wampserver2

WampServer2 is not really a program. And it is not a "server".
It is just a very useful package that installs onto msWindows: the Apache web server, Mysql database, and Php. It also installs PHPMyAdmin and some other useful tools.
And it gives you a nice little control panel to manage the servers. (Well yeah, that part is the WampServer2 program!)

It's easier to do it than it is to write it! But here is a checklist for installing Apache, MySQL, and PHP through WampServer2: (Helpful summary, with screen shots: WampServer.com/en/presentation.php)

1. If Skype is installed, disable ports 80 and 443 in Skype

For some reason the Skype programmers made Skype to start up using ports 80 and 443. These are the ports that your webserver uses! If Skype is using them, your Apache won't work. So we tell Skype not to use those ports.

  1. Start Skype and go to: Tools -> options -> connections
  2. There is a box that is checked, that says 'use port 80 and 443 for incoming connections'
    Uncheck it.
  3. Then quit Skype to make it save that setting.

(You can now restart Skype any time.)

2. Install Apache, PHP, and MySQL with WampServer2

2a. Double-click on the WampServer2 installer icon.

2b. WampServer2 will ask you a few questions:

2c. Now WAMP will install everything, and put a little "W" in your system tray.

If you click on this icon (normal left-click), you will get a menu for managing your servers: starting, stopping, editing configuration files, etc.

3. Test Apache is working

Now open a browser window (FireFox, right?!), and type in the address box:

   localhost

You should see a web page, with the WampServer2 logo and some information about your server. This is showing you an index file in the "document root".
Congratulations! You have a web server!

"localhost" is the local name of your web server on your computer.
In fact, it is the local name of everyone's own web server on their own computer. It is kind of like "me", or "ང་".
My machine (linux laptop) is also localhost. The Macintosh at NAVA Office is also localhost. Your MSwndws machine is localhost. Your friend's MSwndws machine is localhost too. The TibetBridges.com server is localhost, and so is the Yahoo.com server, and the Google.com server, and ... Anyone who has a web server on their machine, their local "domain name" is localhost.

See what happens when the web server is not running:

Go to the wamp menu, and turn off Apache ("Stop all services")
Your little wamp icon should now be white (i think?).
Now reload that 'localhost' page.
The page won't show, and you should see an error message.
Because the web server (apache) is not running, so it can't "serve" the web page at localhost.

If the page still loads, try shift-reload.
This makes the browser try to get the page from the server, not from its cache.
If it still loads — check your browser settings, (e.g., firefox or msie) and make sure that it is not caching pages.
tools -> options -> ... "always get the newest page" ... something like that

apache is not starting! What to do?

Apache is telling us what is wrong, but where can we see what it is telling us?
Now we need to get to the command line (linux terminal or windows dos prompt) to see what apache is telling us.

  1. Open a command window (dos prompt)
  2. Windows: cd to apache's bin folder:
    cd C:\wamp\bin\apache\Apache2.2.11\bin
    (root will "know" where the following command is)
  3. Type httpd -t
    • You may see some output on the screen, telling you there is some error on some line number.
    • Edit the httpd.conf or virtual hosts file and fix the error.
    • Now try httpd -t again.
      • If no errors, try restarting the server.
      • If errors, try fixing again!
  4. If you see no errors through httpd -t, but apache is not running:
  5. If you see no errors through httpd -t, AND apache is running, BUT still no localhost:
    • Check the hosts file.
    • If there are many lines in this file, the first line should be
      127.0.0.1      localhost
    • Some programs (like Adobe) may add other lines to this file, and change the localhost line to 0.0.0.0 (because they think you don't use your localhost!)
    • There may be lines in this file that start with # — these are comments, and are not part of the "lines" we are talking about. (It is always useful to read comments though. :))

For more options to see what apache is doing, type:
httpd -help

4. Put your website files into the document root folder

In MSWindows the server gets the files from C:\wamp\www. This is called the "document root".

"document root" means, the "root", the topmost folder, where Apache looks for files to serve.
WampServer2 puts the document root inside your wamp folder: C:\wamp\www
So we say that www is the localhost document root.

Go to that folder, you should see index.php and some image files.

4a. You can delete all the files in that folder, and put your own website there.

Q. Can i just copy the website folder which has all the folders and files for my website?

A. Copy everything *inside* your website folder — but not the folder itself. Remember that Apache is looking directly into 'www' for an index.html page. You want it to see the index.html of your website, not the folder of your website!

4b. Shift-reload localhost in the browser, and you should see your own website.

4c. This is now where you will work on your website, and view it in the browser, and everything will work just like on the live web server. Actually if you have server-side-includes they won't work yet, but we can fix that!)

Extra – Configure Apache: ssi | document root | virtual hosts

All the below are extra. If you are happy with the way your web server is working, you don't need to do any of the next steps.

To set preferences for Apache web server, we edit a text file called httpd.conf

Assuming you let WampServer2 install everything in its default folder, the httpd.conf file will be in
C:\wamp\bin\apache\Apache2.2.11\conf

It is a normal text file, and you can edit it in any text editor, such as Notepad++.

Notice the lines in the httpd.conf file that have a # in the beginning. They are comments. They don't do anything for Apache, but they are very useful to us!
If you read the comments for the part of the file you are are working on, you will slowly gain good knowledge of Apache and all web servers.

Extra: server-side includes

To set up Apache for server-side includes (SSI), we need to edit two places in the httpd.conf file:

1. Search in the file for something that looks like this:
AddOutputFilter INCLUDES .shtml .htm
You can delete the .shtml and .htm you see there.
Add .html at the end of that line. So it will now look like this:
AddOutputFilter INCLUDES .html

2. Then search in the file for a line that begins Options and add +Includes to that line:
Options +Includes

Extra: Changing the document root

You may not want your document root in C:\wamp\www (or wherever the wamp installer made it). I myself don't like to have my web files in the same folder with my programs. No problem! You can make a folder anywhere on your system that you want. Then you tell Apache that the document root is in that folder.

You do this in two places in the httpd.conf file::

    DocumentRoot "C://wamp/www"

and just a few more lines down:

    <Directory "C://wamp/www">
  1. Change both of those, to the new location.
    (They must be exactly the same.)
    You must write your paths with forward slashes (/), not MSW backslashes (\)
  2. Restart Apache.
  3. Go to localhost in the web browser - it should now be showing the files in the new location.

Extra: Setting up multiple sites (virtual hosting)

See the Virtual Hosts how-to

Extra – Test PHP and MySQL

If you are doing PHP programming,

If you are using the MySQL database, make a database using the MySQL command-line or phpMyAdmin, and see if it works. Write a little PHP script to connect to your database, put it in your document root, and see if it works.

Extra – phpMyAdmin

WampServer2 also installed a very nice web-based MySQL client called phpMyAdmin. You can use this program to do everything with MySQL, such as create databases, create tables, enter data, etc etc etc.

To use phpMyAdmin, type in your browser address bar:
http://localhost/phpmyadmin/

There is a config file in the phpMyAdmin directory, where you may need to put the username and password for your database.

get help

Remember WampServer.com/en/presentation.php for a helpful summary and some screen shots.

Many people in the world are using Apache, PHP, and MySQL, so there are many great resources on the web, to find out anything you want to know.

Some starters:

When i have problems, i usually find good answers when i go to google and type in some words about it.

It would be great to have Tibetan and Chinese translations of this page. Can you help? Contact us! http://tibetangeeks.com/contact/