Last updated on June 2, 2017
Like many people, I have a WAMP server on my laptop where I mock up new websites and run private websites as internal Wikipedia.
I am currently running WAMP 2.2 and it fails – a lot – three times in six months. I have no idea why and each time the symptoms are different.
But I do know what the solution looks like. I need to restore long enough to be able to gain access to my database and back up anything that is not backed up and to set any unusual settings to defaults so I can think about an alternative. But first I must restore WAMP without losing my website files (www) and the databases which are stored in bin.
Here are the steps.
Step 1 Backup your WAMP folder
Simply copy your WAMP folder into C:/ . Windows will keep it as Wamp – Copy.
Have a break and calm down. This might take an hour or so depending on how much is in your database bin and www folders.
Step 2 Print out your passwords and permissions
Try to recall your user, host, password table. If you can log in to phpmyadmin, you will find it there under users. If your can access your mysql console, open it; ignore the password; and type
Select user, host from mysql.user;
The table will show you your usernames and hosts but not your passwords.
Note well that if you are an organized person, this is a table that you might want to keep on hand for emergency purposes. But right now we will proceed assuming that we cannot quite recall what we did when we set up WAMP.
Write down what you can remember and do it now before you start guessing and create chaos later.
Step 3 Print out all the files that you might have edited when you set up WAMP
- wamp/apps/phpmyadminVerNo/config.inc.php (this is where you put your user name and password and where you might have set up authentication and ports)
- /wamp/wampmanager.tpl (you might have changed http://localhost to http://localhost:81 if you have changed the port for apache from 80 to 81 three places)
- /wamp/bin/apache/apacheVerNo/conf/httpd.conf (if you changed the above, you will also have changed Listen 80 to Listen 81 and localhost:80 to localhost:81)
- /wamp/bin/mysql/mysqlVerNo/my.ini (you might have changed the port for myql from 3306 to 3307 – three places)
- /wamp/scripts/testport (where you might have changed 80 to 81 in several places)
- /wamp/lang/English (where you might have change Port 80 to Port 81)
Also write down the Version Numbers for Apache, MySQL and Phpmyadmin.
Check whether your computer is 64 bit or 32 bit.
You are now ready to start restoring WAMP.
Step 4 Download the correct version of WAMP
Find WAMPSERVER on the internet and download the correct version of WAMPSERVER. Don’t be tempted to upgrade while you are restoring. Keep the task manageable.
Step 5 Uninstall WAMP
Go to your Control Panel (from Start) and uninstall WAMP. Uninstall removes everything except your www and bin folders.
Step 6 Install the correct version of WAMP
Install WAMP. I use all of the defaults (IE and dummy email). If I need to fix my email, I do it in a separate exercise.
REMEMBER to enable the rewrite module in Apache. Go to the WAMP menu, Apache, modules. Click on rewrite. And close. Then check again. Sometimes the “tick” doesn’t stick. If you don’t enable rewrite, your websites will not be able to read “pretty urls” that you carefully set up for humans to read and you will get baffling errors.
Step 7 Let WAMP start
When WAMP asks, let it start itself up. You will see the icon in your bottom tool bar and it should go GREEN.
Step 8 Check you have access to localhost
Got the WAMP menu and check you have access to localhost – that is the list of your websites in www.
If your config.inc.php file shows a password (see Step 3), then you don’t have access to Phpmyadmin – fix that in the next step.
Step 9 Fix your password in config.php.inc so you have access to phpmyadmin
Got to your config.inc.php file (see Step 3). If it differs in format from the one you printed out, then you have installed the wrong version of WAMP. Close all services, exit and start again!
If you have the correct version, then change your user name and password. If you have changed your ports, then do nothing else right now.
Stop all services and restart all services (from the WAMP menu).
Check you have access to phpmyadmin. If you get a pink error message #2002 or #1045, then in all likelihood, you have put in the user name and password incorrectly. But sometimes you have little choice but to try to reinstall (start again). In short, at this point, you should have access to Phpmyadmin and clerical error or confused working procedures is a more likely cause of failure than anything more complicated (Don’t google it. That is like looking for medical information – you will just panic. Calm down and work systematically.)
If you have access to phpmyadmin, you should be able to access your user table.
Steps 10 & 11 Access a website
Now go to localhost and access a website. If you did not change your ports, everything should work fine. All done.
If you did change your ports, you have one of two options. Change the port settings on your websites to match the defaults. Or, carry on and edit all the files that you printed in Step 3.
To change the port settings in Drupal, the port setting for mysql is in /www/sites/all/default/settings.php. You have to go to Properties with a right click and change from read-only. Change the port to the default of 3306. Save and set the Properties back to read-only. Remember you will have to do this for every website. Also remember if you test this on one website and then go on to change the port settings, come back to change the port setting to the new number.
If you have edited all the files in Step 3, then this time stop all services, exit and restart WAMP and then all services because you have edited the menu as well as the services you call.
If all goes well, you should be able to access all your websites.
Step 12 Consider changing your server
WAMPSERVER 2.2 seems unstable to me. I don’t know if 2.4 is anybetter. What I do know is that the config.inc.php file in WAMPSERVER 2.4 is radically different from the one in 2.2 and I cannot see how to update the ports.
Also the version of mysql is different which requires an undate of your data tables as well as your software. To upgrade, you might do better to treat the job as a migration and back up all your websites and all your mysql, rebuild your server and then rebuild your websites.
There you go –it might take you an hour to get back into action. If anything goes wrong, it might take several hours. But don’t panic. The web is littered with half instructions and panicky notes. Don’t go near them. Just work very systematically. Check as you go so that you don’t cause more chaos. And everything will work.