Migrate to new version of XAMPP

Install a new version of XAMPP for Windows and migrate your existing configuration.

For many years now I have been using the excellent XAMPP development environment from Apache Friends on my Windows machines.

https://www.apachefriends.org/index.html

This is how I migrate from one version of XAMPP to another. I am primarily using this for WordPress website development, so I am only concerned about the MySQL and Apache Server configuration – your situation may be different and require additional processes.

My XAMPP is installed into C:\Apps\xampp\ – adjust for your own environment.

Backup MySQL databases

Ensure that MySQL is running in the XAMPP Control Panel

Backup the MySQL databases using

C:\Apps\xampp\mysql\bin\mysqldump --user=root --all-databases >"D:\My Backups\all_databases.sql"

Backup Configuration

Stop all modules in the XAMPP Control Panel and Quit.

I backup my XAMPP environment with the following script – not all of these files may be present in your environment.

"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\apps\xampp\apache\conf\create_certs.cmd" 
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\apps\xampp\apache\conf\.rnd"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\apps\xampp\apache\conf\ssl.crt\"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\apps\xampp\apache\conf\ssl.key\"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\apps\xampp\apache\conf\extra\httpd-vhosts.conf"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\Apps\xampp\mysql\bin\my.ini"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\apps\xampp\php\php.ini"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\Apps\xampp\php\ext\php_xdebug-*"
"C:\Program Files\7-zip\7z.exe" a -tZip -spf -y "D:\My Backups\XAMPP.zip" "C:\windows\system32\drivers\etc\hosts"

Install new version

Rename the XAMPP installation.

rename C:\Apps\xampp xampp-old

Get the version of XAMPP to be installed from the Apache Friends site.

https://www.apachefriends.org/download.html

Install XAMPP into C:\Apps\xampp.

Migrate old configuration

Once installed (and before starting any modules), copy the configuration.

xcopy /syf C:\Apps\xampp-old\apache\conf\ssl.crt\* C:\Apps\xampp\apache\conf\ssl.crt\ 
xcopy /syf C:\Apps\xampp-old\apache\conf\ssl.key\* C:\Apps\xampp\apache\conf\ssl.key\
xcopy /syf C:\Apps\xampp-old\apache\conf\.rnd C:\Apps\xampp\apache\conf\
xcopy /syf C:\Apps\xampp-old\apache\conf\create_certs.cmd C:\Apps\xampp\apache\conf\
rename C:\Apps\xampp-old\apache\conf\extra\http-vhosts.conf http-vhosts.conf_orig
xcopy /syf C:\Apps\xampp-old\apache\conf\extra\http-vhosts.conf C:\Apps\xampp\apache\conf\extra\
xcopy /syf C:\Apps\xampp-old\mysql\bin\my.ini C:\Apps\xampp\mysql\bin\
xcopy /syf C:\Apps\xampp-old\php\ext\php_xdebug-* C:\Apps\xampp\php\ext\

The PHP configuration (php.ini) requires some manual updating. Edit C:\apps\xampp\php\php.ini to include your custom settings – I include these at the end of the file, making it easy to copy from the old configuration.

Restore MySQL Databases

Open the XAMPP Control Panel and start the Apache and MySQL modules.

Restore the databases using

C:\Apps\xampp\mysql\bin\mysql --user=root <"D:\My Backups\all_databases.sql" 
C:\Apps\xampp\mysql\bin\mysql_upgrade

Browse to a XAMPP hosted website and confirm correct operation.

Happy coding.

16 views

Need help? Let me take of your IT issues.

Share this page

Share on facebook
Share on linkedin
Share on twitter
Share on print
Share on email
Close Menu