In order to do web development, it’s a good idea to have a local development environment setup. I had setup WampServer on my PC a couple of years ago when I launched my personal WordPress site. It made it much easier to experiment with changes in the WordPress setup and try out different themes.
Recently, I decided to get back into playing around with WordPress and trying some other programming ideas. When I checked the WampServer site, I noticed that they had moved to version 3.0, while I was still on version 2.2. I figured it was time to upgrade. Here are the steps and resources I used to complete the upgrade.
Preparing for the migration
Before downloading WampServer version 3.0, I did a little housekeeping to make sure I could keep my existing data.
- First, I made sure that my existing WampServer version 2.2 was still running and that my old websites would load. I hadn’t run WampServer since upgrading from Windows 7 to Windows 10. I ran into some problems with the IIS services running on port 80 and with WAMP binding to an IPv6 address. The latter prevented me from accessing phpmyadmin, which I needed for the next step.
- Instead of trying to migrate the MySQL databases by copying the ‘data’ directory, I decided to take the approach of exporting the databases from the existing install so I could import to the new install. The WampServer forum posts referenced below recommended the export/import method in order to avoid possible corruption of the database.
- I also noted the structure of each database and the users related to each so I could recreate the database setup after completing the upgrade.
- With those steps out of the way, it’s time to get down to business. Stop all services by left-clicking on the green WampServer icon in the system tray and selecting “Stop All Services” . The WampServer icon should be red.
- Remove the MySQL service by left-clicking the red WampServer icon in the system tray. Select MySQL -> Service -> Remove service.
- Remove the Apache service by left-clicking the red WampServer icon in the system try. Select Apache -> Service -> Remove service.
- Stop WampServer. Right click on the familiar red icon and select “Exit”.
- Rename the existing \wamp folder to \wamp-backup, or something similar. This is important just in case something goes wrong. It’s always a good idea to have a backup, and it allows for a clean install of the new version.
- Download the latest WampServer files from the WampServer site.
Installing WampServer Version 3.0
Once the WampServer install package is downloaded, go ahead and run it, being sure to right click on the installation file and select “Run as administrator”.
- Note the instructions. There are references to Visual C++ runtime libraries that need to be installed. To see if these are installed, go to Add/Remove programs and look for Microsoft Visual C++. In my case, I was missing a couple of these, so I followed the links in the WampServer install package to install them.
- After verifying the prerequisites, proceed with the installation process. I followed their recommendations for the file locations. After doing this, wait for install to complete. It will take a couple of minutes.
- Once the install is complete, open the directory where you installed WampServer, and run the wampmanager application. WampServer will startup. You’ll see the red icon appear in the system tray, and it will cycle through orange to green, which means that the apache server is running. Open a browser and go type ‘localhost’ on the URL address bar. You should see the screen below, which indicates your WampServer is indeed operational.
Now let’s restore our old data and get the websites back up and running.
Restore website and databases
Now that WampServer is running, and Apache is operational, it’s time to restore the previous data. I had a few local WordPress sites, and some test PHP files. I chose to start with the test PHP files since these were a lot less complicated, and then restore the MySQL WordPress databases. Here are the steps I followed.
- Copy the virtual hosts from the old installation, in bin\apache\apache2.2.22\comf\extra\httpd-vhosts.conf, to the new virtual hosts file, in bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf. For the time being, I decided to leave the default Apache settings from the default httpd.conf file installed with WampServer 3..0 which limits access to the file system to the local user.
- Copy over the website directories in the ‘www’ directory of the prior installation to the new WampServer installation.
- Restart the apache services to pick up the new vhost configuration. I loaded in my test directory, and had to do a couple of directory root changes in the vhost file. After that, I got a sample phpinfo() command running that displayed the following:
- Now it’s time to import the old databases into MySQL. To do this, access phpMyAdmin by left clicking on the WampServer icon in the system tray and selecting ‘phpMyAdmin’. At the login screen, the default user is ‘root’, and the password can be left blank (these values can be changed later, if desired). Now load the database(s) that were exported earlier, and make sure that the users have been recreated to ensure access.
Now you can load the website(s) that depend on database access. In my case, I was able to reload my local WordPress websites. While I ran into a few glitches, the process overall was relatively painless for a software upgrade.
Here are the resources I used to complete the upgrade. I would strongly advise skimming these, at a minimum, before proceeding with an upgrade.
- The WampServer site – http://www.wampserver.com/
- The steps outlined in this stackoverflow post, titled Best way to Upgrade wamp 2.0 to 2.5, was helpful. Even though it didn’t apply to the exact versions I was moving from and to, the general outline provided in the accepted answer was close enough to get me most of the way there.
- The WampServer forum post, titled Installing a new release of WAMPServer, had useful tips about installing a new release of WampServer.
- The WampServer forum post, titled WAMPServer 3 All you need to know, also had a number of very useful tips in it.
UPDATE: Getting things to work on Windows 10
If you run into a problem getting Apache to run on Windows 10, it could be due to another process listening on port 80. There are two ways to go about fixing the problem:
- Find the program that is listening to port 80. Skype has been labeled as one particular culprit, but IIS is another process that runs by default that likes to occupy port 80.
- Change the Apache settings through the httpd.conf file to listen on a port other than port 80, such as port 8080.
My personal preference is to use step number 1, and to find out what has port 80 tied up. In my case, it was IIS that runs more or less by default in Windows 10. In order to turn it off, you need to open an elevated command window (means running CMD as administrator) and stop the IIS server. You can do that with the following command:
C:\> iisreset /stop
I’ve found that I have to run that command the first time I start wampserver after a reboot of the computer. Keep this in mind as part of the upgrade process.
Dislcaimer: these steps applied to my specific situation and setup. I am not a WampServer guru. I am documenting these for my personal use in case I need to remember and recreate what I did. You are more than welcome to reference these steps, but keep in mind that they may or may not work for you depending on the specifics of your setup. What I’m trying to say, in not so many words, is that I’m more than happy to entertain questions, but I cannot guarantee timely and accurate responses.