A1Media.ca

Small Business Website Specialists

Get a price quote! 1-877-228-0422

Calgary Website Design Ideas
Blah-de-BLOG!

Tips, tricks, and insights about content
management and the web.

You are here: Home Blog Blog WAMP Problems? Here's a fix.

WAMP Problems? Here's a fix.

Disclaimer: Always have a backup of your c:\wamp folder before you attempt any of the following advice. Use the following information at your own risk.

Desperate and want to cut to the chase? if your WAMP is not working for some reason, just uninstall it via the Add/Remove programs utility and then re-install it.

Okay, here's the longer explanation:

Like most every other web developer, I use local installs of Apache, MySQL, and PHP to develop websites on my personal computer before I upload the finished site to the web server. Back in the day, we used to install each of the aforementioned separately and then configure them to run together; a process that could take an entire day.

Then, one day, several years ago, someone came up with the brilliant idea to package the holy trinity of web development utilites together into one package that could be installed with a single click. The package for Windows PCs is called WAMP (Windows Apache Mysql PHP). For Mac computers it is called MAMP, and there's another flavour called XAMPP that also adds Perl to the mix. All the packages include extra utilities like PhpMyAdmin to make database management a breeze.

If you've been developing websites for more than a week, you'll know that your local web development environment is your lifeblood, so if you screw up the operation of it, it's a bit like having your still-beating heart ripped out of your chest. Overly dramatic, you say? I think not. I have over 1 GB of MySQL data in 121 databases. Yes, I have backups, but re-installs from backups are always a pain especially if you aren't doing weekly DVD backups ... remote backups are great, but can take several hours to download all those individual files and reinstall. And, as is the rule in these things, it's not the stuff you had backed up a week or a month ago on DVD that you actually want ... you want the stuff you were working on today and now your WAMP is spitting errors and Apache won't start.

I had my WAMP (running on WinXP Pro) chuck a wobbly last night after I attempted to add PHP 5.3.0 to the list of version choices. Immediately after the install, WAMP couldn't find my extensions directory, and yet the path was correct. Then it started writing corrupt gibberish to the wampmanager.ini file, and then it couldn't find even the php.ini config file. I spent 4 hours hunting down errors, editing .ini and .conf files, downloading new dll files, renaming dll files, and nothing worked.

I wanted to just re-install WAMP, but I was afraid I'd lose all my databases and data if I uninstalled it. I did fifty Google searches looking for advice if it was okay to just re-install WAMP and not lose the DB data, but couldn't find anything definitive. All the advice I found was focussed on finding and repairing the individual errors. Finally, at 1:37 am, I found a mention in a backwater forum that it was okay to just un-install WAMP and that the data directories would be left intact.

Woo hoo!

What follows is the procedure I used:

Re-installing WAMP:

NOTE: Do not remove your c:\wamp directory during this procedure. Always leave it in place, just create the backup as described below.

Create Backup: I backed up my c:\wamp directory to a new folder, a process that took nearly 2 hours!

Re-install WAMP: Once the backup was safely tucked away to the side, I first tried to simply re-install WAMP on top of the existing install. This actually fixed 99% of the errors, but Apache was still crashing because of the PHP Loadmodule line in the .conf file.

Uninstall WAMP via Windows Control Panel: I then used the Windows Add/Remove programs utility to uninstall WAMP. Then I reinstalled WAMP. Then, holding my breath, I started WAMP.

WAMP started with no errors and all my MySQL databases and data were still intact. Huzzah!

Re-set the MySQL root password:

Because of the fresh WAMP install, you do lose your MySQL root password, so you need to re-set it so your websites that use MySQL can connect and display your web page data.

This can often be a hassle because as soon as you re-set the root password for localhost and 127.0.0.1 via PhpMyAdmin's GUI, you get locked out and can't see your list of databases. Here's what you do to fix that:

Note: Make sure you use the same password for root you had before or you'll have to edit the MySQL connection info on all your existing websites! If you can't remember the password (but you should since you setup new databases all the time), it is in PhpMyAdmin's config.inc.php file. Check the back-up you made before starting this whole procedure (you made a backup, right?).

  1. Start your newly re-installed WampServer,
  2. Go to http://127.0.0.1 or http://localhost,
  3. Click on the PhpMyAdmin link on your WAMP homepage,
  4. Click the privileges link in the main content window,
  5. Add your root password back into the 127.0.0.1 and localhost  by clicking the edit icon for each of these hosts,
  6. Click the little house icon in the left nav column of PhpMyAdmin ... you'll now be locked out,
  7. Using a plain text editor like Notepad or Notepad ++, open C:\wamp\apps\phpmyadminX.x.x\config.inc.php and find $cfg['Servers'][$i]['user'] and the line below it, $cfg['Servers'][$i]['password'],
  8. Make the value for $cfg['Servers'][$i]['user'] whatever you had before, mine was root and it was already there,
  9. Make the value of $cfg['Servers'][$i]['password'] your current / old password,
  10. Save the file and re-start all services using the WAMP tray icon.

Provided all the above went well, you will be able to access all your MySQL databases again via PhpMyAdmin.

From start to finish, it should only take 5 to 10 minutes at most to fix a broken WAMP ... not 5 hours or more!


 

Comments  

 
#1 2010-10-15 05:08
Thank you! This was a big help.
Quote
 
 
#2 2011-02-05 03:13
Thank you!

After I reinstalled Wamp, it didn't work initially.. and I was in panic, but then I find out I installed a newer version of Wamp (which also had a newer version of Mysql)... =)
Quote
 
 
#3 2011-02-06 05:31
Hoi,
I followed the steps but after the installation of the new version of wamp I don't see the databases anymore.
In localhost/phpmyadmin I only have 4 databases, information_sch ema, mysql, performance_sch ema en test.

I have the backup but I even don't know how to restore is.
Any idea's?

Thank you in advance.

Regards, Sara
Quote
 
 
#4 2011-02-06 07:58
Quoting Sara:
Hoi,
I followed the steps but after the installation of the new version of wamp I don't see the databases anymore.
In localhost/phpmyadmin I only have 4 databases, information_sch ema, mysql, performance_sch ema en test.

I have the backup but I even don't know how to restore is.
Any idea's?

Thank you in advance.

Regards, Sara


Did you remove the folder of the original WAMP install? I left mine in place and reinstalled WAMP. Removing the old c:\wamp directory is about the only reason I can think of that you would have a completely new database. I've updated the text above to emphasize the need to leave the original c:\wamp directory in place.


If you left the original c:\wamp directory alone, and then reinstalled WAMP, and it did remove your original MySQL databases, then I'll need to check the latest WAMP to see if it is deleting existing databases.

As for restoring the backup, if indeed you removed the c:\wamp folder, then just restore the backup to its original location. Should work, but I haven't personally tried doing it that way.

Tell us if you resolve the problem.
Quote
 
 
#5 2012-03-14 18:43
You just saved me hours! I had an urgent project to complete, and the last thing I needed was my wamp not working. I didn't try to fix it in any way, just googled the solution and found your post.

Thanks a lot!!!
Quote
 
 
#6 2012-03-21 01:27
i lost my access to phpmyadmin, i restored the backup and it is working quite same as before. restoring the backup was so easy. it just required copy paste
Quote
 
 
#7 Jodi 2012-07-25 08:52
I was locked out ... didn't need to reinstall but your instructions on how to change the password and get back in were very helpful. I find the privileges screen to be very confusing!
Quote
 

Add comment


Security code
Refresh