How to Install WordPress on XAMPP for Local Development
When developing your WordPress website, working locally optimizes the process by increasing both speed and security.
XAMPP is easy to install and also contains a number of other modules useful for website development.
In this post, I’ll share how to install WordPress on XAMPP quickly and efficiently.
What is XAMPP?
XAMPP is a free and open-source local web development application. You can install WordPress on XAMPP using a macOS, Windows or Linux operating system.
WordPress itself isn’t a standalone application so XAMPP’s purpose is to provide the necessary components to run it locally: a web server and a database.
The beauty of XAMPP is that all this is accomplished from the convenience of your computer.
Cross-Platform (X), Apache, MariaDB, PHP, and Perl (XAMPP) are the components that are efficiently installed and integrated together in one application.
Installing all of these programs separately and integrating them on a single machine would be time-consuming and difficult. XAMPP makes it painless by bundling them together.
Here’s a breakdown of all the components of the XAMPP stack:
- Cross-Platform (X) – XAMPP works on macOS, Windows and Linux systems.
- Apache – An open-source cross-platform web server.
- MariaDB – A community-developed fork of the MySQL relational database management system.
- PHP – The server-side scripting language on which WordPress is built.
- Perl – A scripting language used for CGI scripts and as a glue language to tie together systems and interfaces that were not designed to work together.
Additionally, XAMPP also has a virtual machine feature for macOS called XAMPP-VM. It runs Apache, PHP and other components on a Linux-based virtual machine.
This local development environment is fully contained and separate from your computer’s operating system, allowing you more setup customization and flexibility.
Local WordPress development is a key part of many developers’ process. You can tinker and edit a website without worrying about bringing down a live site or having a visitor stumble across an unfinished page.
Local development means no internet connection is needed, making the process faster and a little more secure than when using a Wi-Fi connection that can be hacked.
Your local files can also serve as a backup in case anything happens to your live site.
For details, check out WordPress Local Development: What It is and When to Use It.
Here’s how to install WordPress on XAMPP using a macOS operating system in detail.
The first step to install WordPress on XAMPP is to go to the Apache Friends website and download XAMPP.
You can choose the version you want for the operating system you’re using. Everything can be downloaded from the front page or the Download page.
Once downloaded, click on the XAMPP package icon to launch the installer. If you’re using a Mac, you’ll then drag the XAMPP icon into your Applications folder.
Next open your Applications folder and click on the XAMPP program icon.
If it’s your first time using the application, you’ll be asked for administrator credentials.
After opening the program, the XAMPP stack manager screen will appear which is where you’ll manage the servers from.
The General tab has buttons for starting and stopping XAMPP, opening the welcome page, accessing the Mac terminal with root privileges, visiting the Apache Friends website and entering the XAMPP support forums.
Click Start in the General tab to launch the server.
Managing Stack Services
The Services tab is where you can manage each specific component and ensure that it’s running.
To start an individual service, select it from the list and click Start.
Alternatively, to start all programs at once, use the Start All button at the bottom. To turn off the servers, click the Stop All button.
Enabling the Networks
Moving to the Network tab, you’ll be able to enable specific ports for XAMPP to use during development.
XAMPP has preset ports for you to use. Default ports are 80 and 443. You can also add your own ports by using the Add button at the bottom.
To turn on a port, select it from the menu and click Enable.
Testing It Out
To confirm that XAMPP is working, copy the IP address found on the General tab of the Stack Manager and paste it in a web browser’s URL bar then press Enter on your keyboard.
If it’s working, the page displayed below will appear.
In your web browser URL bar you can also input http://localhost:8080.
Make sure the port number matches the one you enabled on the Network tab.
How to Install WordPress on XAMPP
Now that the application is installed and working, the final move is to install WordPress on XAMPP.
Creating a Database
First you need to create a database. Starting on the XAMPP Welcome webpage, you can access the phpMyAdmin tool from the upper-righthand menu.
You can also go to http://localhost:8080/phpmyadmin/ but be sure to adjust it as necessary to match your port number.
From the Databases tab or the New link in the left-hand sidebar, create a database by entering a name into the Database name field under Databases > Create database.
Database names preferably should be all lowercase and with no spaces.
Change the collation to the standard utf8_general_ci if you don’t have another preference or if your language isn’t there.
Click the Create button.
To install WordPress on XAMPP, download a fresh copy of the installation package from WordPress.org.
After downloading, unzip the package to generate the wordpress folder.
Finding your XAMPP Files
XAMPP files on a Mac aren’t as easily accessible as some other local development applications, but you can access them through the stack manager.
In the Volumes tab you should see a file path with three buttons beside it.
Click Mount. When you do, the other two buttons, Unmount and Explore will become available.
Click Explore to be taken to the mounted lampp volume in your Finder. You can bookmark this for easier access in the future.
Your htdocs folder exists in the lampp drive. Within the htdocs folder, put the unzipped WordPress folder and rename it to something that’s relevant to your website project.
Setting up Your wp-config.php File
You’ll need to do some setting up before you install WordPress on XAMPP. Taking the time to input your database details in the wp-config.php file will expedite the installation process.
Using your file or code editor of choice, open up the WordPress wp-config-sample.php file.
The uncommented code has locations to input the name of your database, username and password.
Replace the placeholder database_name_here text with the name of the database that you created earlier and replace username_here with root. Remove the password_here placeholder text, leaving the single quotation marks empty.
Now that portion of the wp-config-sample.php file should look similar to the image below.
Next, save your newly edited file as wp-config.php. Typically, this can be done by going to File > Save As, but if you don’t see that option, check the documentation specific to your code editor.
WordPress automatically looks for a wp-config.php file when it runs in order to connect to the database so now you’re one step ahead of the game.
Input http://localhost:8080/your-folder-name into your web browser’s address bar, adjusting the port number as necessary to take you to the page where you’ll begin installing WordPress.
When that’s done, you should be greeted with the page below.
Fill in the Site Title, Username, Password and Your Email fields. Then, click on Install WordPress.
The final screen will show your login credentials with a Log In button that will take you to the admin page.
To access the admin page on your own, go to: http://localhost:8080/your-folder-name/wp-admin and be sure to adjust port number if necessary.
Setting up a local server may feel like a terrifying and daunting process, but with the steps above, you can install WordPress on XAMPP in about ten minutes.
Have you ever installed WordPress with XAMPP? What features do you need in a local development application? Let us know in the comments below.