Installing WordPress on a Windows or Mac computer is often the first step in any WordPress website development process. To install WordPress locally, you need the localhost server app. There are many local server applications that you can use and they all work pretty well. Typical examples are WAMP, XAMPP, Local by Flywheel, and Desktop Server.
In this tutorial, we will be using XAMPP to install WordPress on localhost.
Why install WordPress locally?
Here are some of the benefits of installing a website first on your computer before moving it online.
- Provides flexibility and saves time : Building a modern WordPress site from scratch takes time. If you took the direct route (setting up and designing WordPress on a live server), you would spend hours online to get your site up and running. However, if you choose to install it locally, an internet connection is only needed when you want to launch a website on the internet.
- Minimizes Downtime : You can’t afford to make drastic changes – like changing the theme – on a live website. This can break your site and it will seriously affect your site’s uptime and reputation. The best option is to test it offline and then make real-time changes after exhaustive testing.
- Faster Development : Installing WordPress locally gives you the ability to quickly test plugins and themes. And you can do it without breaking anything on your live site.
How to install XAMPP?
In order for WordPress to work, you need three things:
- Server-side programming language like PHP
- Web server application. Apache is the most common
- Database management technology such as MySQL
While you can install all three of these platforms separately, things can get out of hand, especially if you’re inexperienced. To save time — and a lot of headaches — just install XAMPP.
XAMPP stands for cross (X) platform, Apache MySQL, Pearl, and PHP. Basically what it does is provide the complete environment that WordPress needs to work. XAMPP is free, easy to use and install, and super lightweight.
So, to get started with XAMPP, go to the official site https://www.apachefriends.org/index.html and download it.
You will need to select an operating system.
In this tutorial we will illustrate how to do this on Windows, but the steps are very similar for Mac.
After the download is complete, run the installation file. The installation process is pretty straightforward and straightforward.
Once the installation is complete, launch XAMPP. Start Apache and MySQL.
This is what you should see when starting Apache and MySQL
Solving XAMPP Error on Windows
Often Windows users will report port errors when trying to start XAMPP for the first time. Here is a screenshot of the Apache error. (Note: if you had no problems getting Apache and MySQL running, skip to the next section).
If you run into this error, don’t panic! This happened because another program on your computer is using the same port that Apache and MySQL are using: port 80 or 443.
Here’s how to fix this problem.
1: close XAMPP
2: start Windows Security. You can do this by clicking the menu button and searching.
3: Windows Defender Click Device Security – Advanced Options
4: On the next page, click on Inbound Rules on the left and select Create New Rule from the right menu.
5: Select port as rule type and click Next
6: select TCP. Enter 80 and 443 on specific local ports.
On the next screen you need to select “Allow the connection” , click Next
Make sure all three are checked before proceeding.
7: Enter a name in the name input area. You can enter any name you like. For this example, we will use “testwebsite”. The description is optional. Then click the Finish button.
8: Repeat this process again. This time, change the name to “testwebsite2”. When you’re done, restart your computer. Everything should work fine now.
How to install WordPress on XAMPP?
Now that we have XAMPP, let’s set up WordPress by following these steps
Step 1: Download WordPress
Go to the official WordPress download site https://wordpress.org/download/ to get the latest version of WordPress
Step 2: extract the downloaded folder
WordPress comes in a zip archive, so you need to extract it first.
Step 3: copy the extracted folder to XAMPP registry
Since we are using Windows, copy the extracted folder to:
C: \ xampp \ htdocs
For Mac users, the XAMPP registry takes the following form:
Application / XAMPP / htdocs
Step 4: rename the folder
Although not required, we recommend renaming the folder. For this tutorial we will rename the folder to “testwebsite”
Step 5: launch the website in a browser
If XAMPP is still running, open Google Chrome (or any other browser of your choice). Enter “localhost / testwebsite” in the tab
What you will see next is:
Step 6: create the database
As you can see from the screenshot, a database is required to run WordPress. So let’s create it! To achieve this, go back to XAMPP and in the MySQL section click Admin.
This will open the localhost / phpmyadmin page in your browser. Click on the databases button.
Enter a name for your database. In this case, we will use the same name as the WordPress folder. Finally, click the Create button.
Now that we’ve created our WordPress database, go back to where we left off in step 5. Click the lets go button. Fill in the input areas as follows:
Click the button start installation
Finally, choose a site name, set your password, enter your email address and install WordPress.
Once installed, log into your WordPress dashboard and start developing, designing or testing.
Congratulations, your local site is up and running
Using our example folder name, you can access your local WordPress site by going to localhost / testwebsite and WordPress admin to localhost / testwebsite / wp-admin.
Installing WordPress on your computer is a fairly simple process. Even the most seasoned developers start by setting up WordPress locally before moving it online.