How to Transfer Your PHP/MySQL Site to XAMPP for Local Development and Debugging

Illustration of a laptop displaying coding symbols, surrounded by icons representing various programming languages like PHP, CSS, SQL, HTML5, and Java against a gradient background. Learn how to transfer your PHP/MySQL site to XAMPP for local development and debugging seamlessly.

About six months ago, PHP 5.6 reached End-Of-Life, which means that for the months before December 2018, I was tasked with updating code on some sites that were not PHP 7.2 compliant. To do this without affecting the live site, a copy of the site is made, recreated locally, debugged, tested and updated, and then transferred back to the live site.  So how exactly is this process accomplished? XAMPP is the bread and butter behind this type of upgrade.  

Step 1: Get Copies of Files and Database

The first step of the process is to download XAMPP.  You can also use MAMP or WAMP, but in this guide, I will be using only XAMPP as it is cross-platform.  Installing XAMPP is relatively simple, once you download it go through the installation wizard until it is complete.  Once XAMPP is fully installed, let’s test to make sure everything is working properly. Open the xampp folder (default for windows is C:\xampp, but it could be different if you changed it during installation), and launch the xampp-control file. 

Once you have XAMPP set up on your site, the next step is to export a copy of your database through phpMyAdmin.  It is possible that your site doesn’t use a database at all, if that is the case you can skip to the next section.

  1. Sign in to phpMyAdmin and select the database you want to export.Screenshot of phpMyAdmin interface showing database navigation pane with databases named: 000example, 381744, and 945915_wia. The "Recent" and "Favorites" tabs are visible at the top—ideal for those learning how to transfer your PHP/MySQL site to XAMPP for local development and debugging.
  2. Click the export tab, set the format as SQL, and press Go
  3. Move the file to a folder that will contain a backup of the files and folder. (C:\Users\##YOURNAME##\Desktop\Backup\)

A screenshot of phpMyAdmin showing the export interface for a table called "000example." The export template section is displayed, with "SQL" selected as the format and the "Go" button visible. Learn how to transfer your PHP/MySQL site to XAMPP for local development and debugging using this tool.

Now that you have a copy of your database, all that is left is to grab a copy of all your files from your server.  You will need FTP access to do this, and an FTP client, we suggest Filezilla. Using Filezilla, enter your FTP credentials and create a connection to your server.  Simply download all the files from your root level connection and save it into the backup folder (C:\Users\##YOURNAME##\Desktop\Backup\).

Step 2: Add Files and Database to XAMPP

Now that we have everything needed to recreate the site locally, we can start working with XAMPP. The first step is to copy the files from (C:\Users\##YOURNAME##\Desktop\Backup\) into your XAMPP htdocs folder, inside of a test folder (C:\xampp\htdocs\test\).  

With the XAMPP Control Panel open, start Apache and MySQL, then click the Admin tab on MySQL.  The XAMPP Control Panel v3.2.2 interface, essential for how to transfer your PHP/MySQL site to XAMPP for local development and debugging, features modules like Apache, MySQL, and FileZilla with status indicators and control buttons. A log at the bottom displays recent actions and error messages.

Once phpMyAdmin is open, create a new database with the same name as the live database, in my scenario, it will be 000example. Screenshot of a database creation page showing an input field with "000example," a dropdown menu set to "latin1_swedish_ci," and a highlighted "Create" button, illustrating steps for transferring your PHP/MySQL site to XAMPP for local development and debugging.

On the sidebar, click the newly created database and click the import tab.  With the import tab open, select the.sql file and press Go at the bottom. This will complete copying the database locally.Screenshot of a database import interface showing an SQL file named "000example.sql" selected. Sections include options for partial import, file hibernation, other criteria, and a "Go" button. Ideal for those learning how to transfer your PHP/MySQL site to XAMPP for local development and debugging.

Step 3: Setup Virtual Environment

Now that we all of our files and database setup, we need to create a virtual domain for the site.  Open up C:\xampp\apache\conf\extra\httpd-vhosts.conf. At the bottom of the file add the following code:

   <VirtualHost *:80>

   DocumentRoot “C:/xampp/htdocs/”

   ServerName localhost



   <VirtualHost *:80>

   DocumentRoot “C:/xampp/htdocs/test/”



Finally, for the last step, open up Notepad as an administrator and open C:\Windows\System32\drivers\etc\hosts.  At the bottom of the file, add the following: localhost

Now that everything is set up, we can open up our browser and visit, and we can see our local site.  Here we can make changes to the site without worrying about affecting the live site!

Note, if you have database connection issues, you will need to locate the database connection file within your project and update the connection.  If you are using mysqli to connect to your database, your connection should use the following: mysqli_connect(‘localhost’, ‘root’, ”, 000test’)


Share This

Join the Sales and Marketing News, receive our last insights, tips and best practices.

Our 7 Guarantees

Keeping 2,000+ Clients Happy Since 2001.

You Will Love Your Design We design to please you and your clients
Same-Day Support 24-hour turnaround edits during business hours
Free Education We provide knowledge to help you expand
No Hidden Charges We quote flat-rate projects
Own Your Site No strings attached
We Create Results SEO, PPC, content + design = clients
We Make Life Easier One agency for web, branding and marketing