As part of my latest project, I decided to try out WampServer, the Windows development environment for developing web applications with Apache web server, MySQL database and PHP scripting (Windows, Apache, MySQL, PHP – WAMP). Packages like WampServer and EasyPHP are simplified ways to create a testing environment on your PC without spending a lot of time downloading, installing and configuring the individual components. The package also includes utilities such as PHPMyAdmin and SQLBuddy for managing your MySQL databases and writing SQL queries. The software is available in 32- and 64-bit versions and the installation is pretty straightforward.
- WampServer installs to a folder outside the usual Program Files directory (c:\wamp by default) and you have the option of choosing your own location. A subfolder of this location, ‘www’, functions as the file location for any web files that you create and want to host through ‘localhost’. WampServer can also be installed to a flash drive for use on multiple machines.
- The installation will also ask you for an SMTP server and e-mail address it can use when accessing the PHP mail() function. You can leave these at their defaults of ‘localhost’ and ‘email@example.com’ or supply actual values.
- The installation also asks you to manually browse to the EXE file for your preferred default web browser. I’m not sure why it doesn’t access the default browser set in Windows but it’s a simple step.
Once the installation is finished, you can start the WampServer environment by selecting the ‘start WampServer’ menu item from the Windows start menu. The environment is controlled from the system tray icon which provides a menu with management selections for all the modules as well as start, stop and restart commands for the entire system.
The system tray icon also functions as a status indicator, initially showing red and then orange or green as components come online. If the icon remains red or orange, it means that one or more components are not working as they should. Apache, MySQL and PHP all have error logs that are accessible from the WampServer menu and it’s a good idea to check those if there’s any problem but here are a couple of things you can also try.
One of the first things to check whether another software is using communications port 80 on your system. Apache defaults to port 80 but so do other packages like Skype. In my case, I have Microsoft IIS installed and it had already called dibs on the port. You can find out if another software is using port 80 by selecting the Apache >> Service >> Test Port 80 options from the WampServer menu. Removing IIS and SQL Server, which can also claim port 80, was one solution but not one I wanted to go with.
The next solution I found online was to change the port that Apache was using to another one, like 7080. You can actually test to see if a port is being used by opening a command window (Start >> cmd) and typing the following:
This will provide you with a list of all current port connections along with the ID (PID) of the process involved which you can look up in Task Manager. If port 80 is in use, you can decide on an available port number not listed there and change WampServer’s preference by selecting the Apache >> httpd.conf options from the WampServer menu. This will open up the configuration file that tells Apache what port number to use. It will probably open in Notepad and look like complete gibberish since Notepad doesn’t recognize the line breaks. If you do have a better editor, like Notepad++, you can find the file in the C:\wamp\bin\apache\apache2.4.9\conf subdirectory and open it from there.
If you don’t have another editor to use, just use CTRL-F in Notepad and search for the ##Listen command within the file. Then change the commands to match the following (assuming port 7080), replacing “:80” with “:7080” in both places. (Listen 188.8.131.52.78:80 is preceded by a # – it’s a commented line.)
Listen 0.0.0.0:7080Listen [::0]:7080
After you save the file, close it and choose the Restart All Services option from the WampServer menu. Give it 30 seconds or so and see if the icon turns green. If it does, open your web browser and go to the following address:
This specifies localhost and the port number. If everything is working, you should see the following screen:
If that doesn’t work … be sure the Apache and MySQL services are actually installed.
After messing around with different options on my system, I decided to do a system restore to get my IIS back to normal and reinstall WampServer with the port adjustment I outlined above. After I started it from the Windows Start menu, the status icon actually stayed RED, much to my concern. I checked the port and it was set to 7080 which was not being used.
The next things I checked were the the Apache and MySQL Service menus under the WampServer menu. The Service menus enable you to start, stop and restart the services or perform installation functions. In my case, the start / stop buttons were completely grayed out which suggested to me that the services had not been installed during the installation. So, I selected the Install Service option under both the Apache and MySQL menus. After that task completed, I chose Restart All Services from the main WampServer menu and, after a tense moment, the status icon showed green.
If you’re using EasyPHP WAMP dev server …
The procedure for changing the port number also works on EasyPHP with the added bonus that this server will automatically specify the corrected port number when you select the Local Web (F7) from the Administration menu. To change the httpd.conf file in EasyPHP, select Configuration >> Apache from the system tray menu.
For more information …
Again, if neither of these work, check the error logs from the individual component menus to see if you can get any sense of what went wrong. Google is generally my first stop and that will likely take you to the WampServer forum or StackOverflow, both of which can provide a lot of good information on working with the software.
MySQL does not have to be a mystery!
MySQL Explained offers a complete guide to the installation and use of MySQL and is written for people without a background in I.T. or database design. MySQL Explained takes the reader from the very basics of database theory through the installation options for MySQL and the design of custom databases based on everyday real-world examples. Find out more and get your copy on LeanPub.com and Amazon.com in paperback and a variety of electronic formats!