How To Set Up Your Own WampServer

Sent to you by Tim via Google Reader: 

via MakeUseOf.com by Dave Drager on 9/25/08

 

There once was a great cat, named the WAMPUS cat. However, this article is not about that cat. This article is about a server. A great majority of websites are run by a trio of services - Apache, MySQL and PHP. Apache is the web server, which handles browser requests and sends the information across the internet to your browser. PHP is the programming language that many sites are written in - this creates dynamic content which in turn is sent to Apache, which sends the data to your browser. And finally, MySQL is the database which stores the information for programs. PHP is used to access this database.

AMP

It is a tried and tested trio which works phenomenally well. Usually to gain access to this trifecta, you need to purchase hosting, and this hosting is usually run in a far away datacenter running on a Linux server. However, not many people know that it is available locally, and for Windows as well. You can use these services for running your own applications, and also for locally testing software you are writing, before uploading code to a production server.

WAMP stands for Windows Apache, MySQL and PHP. Compare this to LAMP, which is Apache, MySQL and PHP on Linux.

There are several ways to get these services running locally. Each service, by itself, has Windows installers. That being said - once the programs are installed, you need to know how to configure the services. That may not be simple unless you happen to be a system administrator.

We are going to focus on WampServer. In my experience, using WampServer is the fastest way to get up and running. Wikipedia has a nice list of all Wamp servers.

Step 1

Download the latest WampServer. As of the writing of this article, it includes Apache 2.2, PHP 5.2 and MySQL 5.0.

Step 2

Run the installer. It will warn you to uninstall WAMP5 1.x if you have installed that already. You can use the defaults and it should install without problem.

Step 3

Start the services. You will see a small icon in your taskbar. Left click on it (right clicking does not display the right menu) and select “go online”. The icon will then make a little animation, and your services will be online. You can view your homepage by going to http://localhost/.

Thats it! Wamp is now running. You are ready to install your application, or start learning some PHP! The public website directory is ‘c:\wamp\www\‘.

Any directory you create in this directory, shows up as a ‘project’ on the main index page.

Advanced Settings

PHP Customization

Depending on which type of program you want to install onto your server, you may require additional extensions that are not loaded by default. There are a whole variety of PHP extensions you can load that come built in, but disabled. Left-click on the Wamp menu, go to PHP->PHP Extensions and click off the extension you would like to reload.

You can also edit the configuration file, php.ini through the menu. Edit anything you need, and save this file. The most common edit is the memory_size, but there are many options you can tweak to your liking.

After making any changes to php, make sure you reload apache. I’ve learned the hard way that changes aren’t automatically pushed to the server, until it is reloaded.

Apache Customization

For you advanced tinkerers out there, you can tweak the apache configuration files to your heart’s content. Make sure after making any changes, to reload apache.

MySQL Customization

Depending on your project, you may need to create a database in MySQL. This can be done through phpMyAdmin, which is handily included within the WAMPServer install. By default they include no password on the root MySQL user, which is not the best thing for security reasons. I would recommend changing this password. phpMyAdmin can be reached via the Wamp Menu, or via the url http://localhost/phpmyadmin/

In Summary:

Don’t let the fun stop there. Install a blog and start experimenting with PHP and templates. Run your own Wiki. Run your own music server. The howtos on how to install some neat programs are coming in some future articles.

One of the greatest things about running a home apache server, is that you can use it in combination with a VPN (Hamachi) to access your server anywhere in the world, securely. You can even change your setup to host pages to the outside world, if you so desire.

There is no limit to what you can do! OK, maybe it won’t cook you breakfast in the morning - not yet anyway!

Please let me know if you have any questions, comments, or need help with the install!

Dave is an IT Manager by day and technology consultant by night. He is interested in all things internet, but especially interested in security, history, and networking. He lives near Philadelphia with his family. You can follow Dave on twitter.