From time to time, I—and maybe you, too—want or have to upgrade XAMPP (i.e., install it again, in a newer version). I did this, for example, when switching PHP versions, or when I moved from MySQL to MariaDB. Instead of installing the new version on top of the current one, I decided to take another route, which I will explain in this very post.

It might be worth mentioning that I am writing this short tutorial mainly for the future me, although the post should be of good use to anyone with a similar setup. 🙂

The Current Situation

This tutorial, obviously, assumes you already have XAMPP installed, and one or more local hosts set up, which means there are custom files in htdocs/, and MySQL databases and tables created.

Of course, you also might have installed one or more additional PHP extensions, and customized or at least completed some config files for things like PHP, MySQL, or even the XAMPP Control Panel.

The Desired Situation

The goal is to have a clean XAMPP installation in your desired version, with all local hosts still working fine, and all of your current … let’s call it configuration.

What we do not want to have is a bloated xampp folder with lots of stuff that is old, outdated, obsolete and other words starting with “o”. 😉

Moving from A to B

Reaching the desired situation is really not that hard at all. And it only takes very few steps to cleanly upgrade XAMPP.

Taking Care of the Current Installation

There is one important thing that dictates what to do first: the type of update for MariaDB. If its version doesn’t change at all—very unlikely, though—or if the new version is a patch or minor update of the current one, then you don’t have to do anything special right now. A patch and also a minor update does not break any existing functionality, but only fixes bugs and/or introduces new features.

However, if the new version of MariaDB is a major update with respect to the current one, you should export all your databases.

After that, start XAMPP (i.e., the XAMPP Control Panel), stop all running services such as your Apache and MySQL server, then quit XAMPP (i.e., actually close the application, not just hide it to the system tray). Finally, rename the folder that XAMPP is installed in, for example, to xampp.OLD/.

Installing XAMPP

Well, then, install XAMPP like the first time.

I only use the Apache and MySQL server, PHP, and phpMyAdmin. No need for an FTP server, Perl, Webalizer or any of the other available stuff. But you can, of course, do whatever you like here.

Adjusting the New Installation

Now, we only have to make sure the new installation behaves just like the old one, but … only in new. 😀 So, we would like to end up with a clean version of what we have when we regularly upgrade XAMPP.

Moving the (Local) Server Files

In order for both Apache and your operating system to work with your local hosts (i.e., the respective files), you have to move (or copy, if you want to be extra cautious) them from your old installation to the new one. By default, you will find them in htdocs/.

Moving the Databases

Now, this is the tricky part! Or not. It depends…

If you exported your databases before—because MariaDB was about to get a major update—you have to import them now, of course.

However, if you did not create any database dumps—meaning MariaDB only got a patch or minor update—all you have to do is to copy (or even move) the old data from the xampp.OLD/mysql/data folder to the new install (i.e., xampp/mysql/data). Done.

Taking Care of Your Configuration

Apache

Move your Apache hosts file, apache/conf/extra/httpd-vhosts.conf, to your new installation.

MySQL

Merge in any relevant changes in your MySQL config file, mysql/bin/my.ini. The only thing I did here was setting the max_allowed_packet size from the initial 1M to 32M.

PHP

You then want to take care of additional PHP extensions. Either move (or copy) them to you new installation (i.e., php/ext/), or even update them to the newest stable version. In my case, this is Xdebug.

After that, merge in any relevant changes in your PHP config file, php/php.ini. Since I had (in to too rare cases) trouble with larger plugin updates from a local WordPress website, I decided to set the max_execution_time to 90. I also set error_reporting to E_ALL. And, like mentioned before, I am using Xdebug, so I include the according configuration.

phpMyAdmin

Check if you did any customization to your phpMyAdmin configuration. Therefore, merge the phpMyAdmin/config.inc.php file. In my case, for example, I set some random password for the root user, because some app—I think it was Joomla—complained about using an empty string here. I also set a higher limit for the maximum execution time, by adding the following to the end of the file (replacing the closing ?> tag, if any):

$cfg['ExecTimeLimit'] = 90;
XAMPP

Not only services and web front ends (might) have been customized, but also XAMPP itself. To keep it, merge the XAMPP Control Panel config file, xampp-control.ini, directly in the xampp folder. Besides making both Apache and MySQL start automatically, I define Notepad++ to be my editor of choice (for config files).

Anything Else?

Depending on what you did to your XAMPP installation, there might be more stuff that you want to keep.

I am also using the Xdebug profiler from time to time, so maybe I still have some interesting Callgrind files somewhere—I output them to tmp/profiler/.

That’s It!

Well, that was all there is to do to cleanly upgrade XAMPP.

Open up your XAMPP Control Panel, start your desired services, and happy web developing! 🙂

If you have any comments, please let me know.


PS I actually moved away from XAMPP just yesterday, and started to manage Apache, MariaDB, PHP and phpMyAdmin as separate software installations from now on. Anyway, I nevertheless decided to finally finish and publish this post as it might be useful for someone else.

5 responses to “Upgrade XAMPP the Clean Way”

  1. I had trouble at this point in your writeup, “…After that, start XAMPP (i.e., the XAMPP Control Panel), stop all running services such as your Apache and MySQL server, then quit XAMPP. Finally, rename the folder that XAMPP is installed in, for example, to xampp.OLD/.”.

    I quit Xampp when I clicked Quit from the Control Panel, but when I tried to rename the xampp folder it said it was still in use.. It was still running apparently. When I went into the task tray and right-clicked the icon, I could then rename the xampp folder.

  2. Hallo Thorsten

    ich hab deine Schritte genauso durchgefĂźhrt, die HTDOCS auf das neue XAMPP Verzeichnis umgezogen, die Datenbank geschoben und wenn ich jetzt das Control Panel starte, dann will meine WordPress Installation, die bisher astrein lief, eine NEUINSTALLATION, das kann ich nat. nicht gebrauchen!

    Apache startet wieder mit http://localhost/doerren/wp-admin/install.php

    Wo ist der Fehler bzw. wie behebe ich ihn? Danke, mit Gruss HANS

    • Hallo Hans,

      wenn WordPress nach einer (Neu-)Installation fragt, dann ist die Datenbank leer. Hier muss also etwas beim Verschieben bzw. Importieren der Daten schief gelaufen sein.
      Ich weiß natürlich nicht, von welcher zu welcher Version du aktualisiert hast, und was in Sachen MySQL/MariaDB da passiert ist.

      Zur Not mĂźsstest du die Datenbank exportieren und in der neuen Version wieder importieren. Sofern nicht vorher schon getan, bedeutet das vielleicht auch, dass du noch einmal (temporär) eine alte Version von XAMPP installieren musst…

      Viel Erfolg und viele Grüße,
      Thorsten

      P.S.: Kleiner Hinweis am Rande: ich nutze seit geraumer Zeit kein XAMPP mehr, sondern bin zu Local gewechselt.

Leave a Reply

Your email address will not be published. Required fields are marked *