XAMPP Apache “Error: Apache shutdown unexpectedly.”

There’s a load of methods on the internet that just don’t seem to work to sort this error out.

Methods from messing with the port numbers, messing about with windows itself (Web Services that I can’t even find on Windows XP), and messing with Skype port numbers. At times like this, a re-install is in order.

We must back up our web files and our database files before we do anything, else we’ll be facing a loss of the website(s) that we were working on.

Clear step-by-step instructions for re-installing XAMPP

Here goes.

1) Back up your files

Go to your XAMPP folder and locate all the files and folders in the htdocs folder.

Now copy and paste this into a new folder on your desktop. This is all your html and css files, and all your php coding if you have done dynamic stuff in your websites.

We will make a further backup in a later step just to make sure we don’t lose anything.

2) Back up your databases

Now open XAMPP as an administrator. Go to XP start menu, and search for XAMPP, now right-click and select ‘Run as Administrator’. When it opens, Start MySQL.

Now click on ‘Shell’ from the right menu and type in the following command:

mysqldump -u root -p –all-databases > all-db-dump.sql

This will now save all your databases from XAMPP to the XAMPP folder.

The file is called:

all-db-dump.sql

Backup that file by copying and pasting it onto your desktop.

3) Rename your old XAMPP installation

As a double backup, now close down XAMPP and rename the folder xampp to another name, such as xampp-old.

This will ensure if something screws up, you will still have your original data handy and you can revert to it!

If you get the following error when you try to rename the c:\xampp folder (or whichever drive you have it installed on)…

.. and you’re sure all the windows relating to xampp folders and files are closed, it’s probably because xampp is running in your system tray.

Right click it and select Quit.

Now try to rename the xampp folder again. It should now rename just fine 🙂

4) Install a new version of XAMPP

Go to the apache site and download the latest version of Xampp.

I’m going to use the latest 7.3.9 version.

If you get a warning related to UAC (user account control) – I just ignored it and continued with the install.

Once installed my apache and mysql were working fine.

5) Setting XAMPP up as it was before

Now Copy the htdocs folder from ‘xampp-old’ folder to ‘xampp’ folder. (Remember you also have a copy of this on your desktop, but don’t delete that yet as the mysql database file is there as well if you copied that into that folder).


Now we need to sort out the php.ini file. Go to XAMPP, and click on CONFIG and delete php.ini. We need to set various variables to the following values which are the values taken from the original installation (xampp-old)

upload_max_filesize = 10M

memory_limit = 1024M

post_max_size = 13M

The original values for my working site are as below.

Note:

post_max_size and memory_limit must be larger than upload_max_filesize


Now in XAMPP start up Apache and MySQL

Click on ADMIN my the MySQL to open up phpMyAdmin

Go to the Import tab and navigate to your all-db-dump.sql file that is the backup of your database. Click Go and your database should be restored!

This Post Has 2 Comments

  1. slot online

    Hi, I do think this is a great blog. I stumbledupon it 😉
    I may come back once again since i have bookmarked it.
    Money and freedom is the greatest way to change, may you be rich and continue to guide others.

Leave a Reply