WAMP, MAMP, and LAMP are abbreviations for “Windows, Apache, MySQL, and PHP,” “Mac, Apache, MySQL, and PHP,” and “Linux, Apache, MySQL, and PHP.” These abbreviations describe a fully functioning setup used for developing dynamic Internet web pages.
WAMPs, MAMPs, and LAMPs come in the form of a package that binds the bundled programs together so that you don’t have to install and set them up separately. This means you can simply download and install a single program, and follow a few easy prompts, to get your web development server up and running in the quickest time with a minimum hassle. During installation, several default settings are created for you.
Installing XAMPP on Windows
There are several available WAMP servers, each offering slightly different configura‐tions, but out of the various open source and free options, the best is probably XAMPP. You can download it at http://apachefriends.org
Once you’ve downloaded the installer, run it to bring up the installer window. Before arriving at that window, though, if you use an anti-virus program or have User Account Control activated on Windows, you may first be shown one or more advisory notices, and will have to click Yes and/or OK to continue installation.
Click Next and then uncheck any of the components that you don’t need. For example, at the minimum for this article you will want to keep Apache, MySQL, PHP, and PHPMyAdmin checked.
The other features are not covered in this article, but you can get more details on all of these, plus the core XAMPP technologies, at http://apachefriends.org/faq_windows.html.
Clicking Next brings up the screen in which you should choose a folder for the installation.
Its recommended to accept the default provided unless you have a good reason to choose a different one. In this book, the default location is assumed. If the folder you choose exists and is not empty, you will be unable to use it.
Click Finish to complete installation
Testing the Installation
The first thing to do at this point is verify that everything is working correctly. To do this, you are going to try to display the default web page, which will have been saved in the server’s document root folder.
Enter either of the following two URLs into the address bar of your browser:
localhost
127.0.0.1
The word localhost is used in URLs to specify the local computer, which will also respond to the IP address of 127.0.0.1, so you can use either method of calling up the document root of your web server.
Accessing the document root
The document root is the directory that contains the main web documents for a domain. This is the one that is entered when a basic URL without a path is typed into a browser, such as http://yahoo.com or, for your local server, http://localhost.
By default, XAMP uses the following location for this directory:
C:/xampp/htdocs
To ensure that you have everything correctly configured, you should now create the obligatory “Hello World” file. So create a small HTML file along the following lines using Windows Notepad or any other program or text editor, but not a rich word processor such as Microsoft Word (unless you save as plain text):
<html> <head> <title>A quick test</title> </head> <body> Hello World! </body> </html>
Once you have typed this, save the file into the document root directory previously discussed, using the filename test.htm. If you are using Notepad, make sure that the “Save as type” box is changed from “Text Documents (*.txt)” to “All Files (*.*)”.
Or, if you prefer, you can save the file using the .html file extension; either is acceptable. You can now call this page up in your browser by entering one of the following URLs (according to the extension you used) in its address bar:
http://localhost/test.htm
http://localhost/test.html
Alternative WAMPs
When software is updated, it sometimes works differently than you’d expected, and bugs can even be introduced. So if you encounter difficulties that you cannot resolve, you may prefer to choose one of the other solutions available on the Web instead.
You’ll have to follow the instructions supplied with each WAMP, which may not be as easy to follow as the preceding guide. Here’s a selection of some of the best, in my opinion:
• EasyPHP: easyphp.org
• WAMPServer: wampserver.com/en
• Glossword WAMP: glossword.biz/glosswordwamp
Installing XAMPP on Mac OS X
XAMPP is also available on OS X, and you can download it from http://apache friends.org. Double-click the .dmg file once downloaded, and then double-click the installer and follow the same sequence of instructions as for Windows (although you may also be given checkbox options to choose whether to load the core files, developer files, or both).
The installation process is similar to Windows, but with XAMPP being installed in the following location:
/Applications/XAMPP
Upon successful installation, the XAMPP Manager window will open. To ensure XAMP can take proper control of web serving on your Mac, first you may need to turn off any Apache web server your Mac is already running, by entering the following in a Terminal window:
sudo apachectl stop
Now you can click the middle tab (entitled Manage Servers) at the top of the window, and then click Start All to get the XAMPP servers running.
After this, click the Welcome tab to return to the main Manager screen, and then click the Go to Application button, which will call up the web page . You are now all set to use the software suite. For more information on installing and using Mac XAMPP, please refer to apachefriends.org/faq_osx.html.
Accessing the Document Root
On Macs, the XAMPP document root (in which web documents are stored and served from) can be found at /Applications/XAMPP/htdocs.
To test your new installation, type some HTML such as the following into TextEdit (or any editor that can save as plain text) and then save it in the document root as test.html. If you then type localhost/test.html into the address bar of your browser.
<html> <head> <title>A quick test</title> </head> <body> Hello World! </body> </html>
Installing a LAMP on Linux
there are dozens of popular flavors of Linux, and each of them may require installing a LAMP in a slightly different way, so I can’t cover them all in this article.
However, many Linux versions come preinstalled with a web server and MySQL, and the chances are that you may already be all set to go. To find out, try entering the following into a browser and see whether you get a default document root web page:
http://localhost
If this works, you probably have the Apache server installed and may well have MySQL up and running too; check with your system administrator to be sure.
If you don’t yet have a web server installed, however, there’s a version of XAMPP available that you can download at apachefriends.org. Installation is similar to the sequence shown in the Windows section, and if you need further assistance on using the suite, please refer to apachefriends.org/faq_linux.html