Why We Should Install WordPress Locally?
Setting up WordPress on your Local PC/Windows machine is not a very easy job. Moreover, setting up XAMPP also requires a good understanding of it. But let me tell you that, once it’s installed you can run WordPress locally without any issue. And we are here to make that tough task easy. Using this guide you can set up XAMPP on PC/Windows and after that, you can Install WordPress locally on XAMPP and run in PC/Windows.
If you are running an active blog or you want to learn WordPress, then a localhost environment would be very useful for you. Hence you need to know the procedure to install WordPress on localhost. If you are a blogger then you must maintain a localhost environment, so that you can install & test new versions of themes, plugins etc before updating it to your live blog.
[Note: Even if you maintain a test environment, we recommend running your live blog with a reputed webhost, who are having backup facilities. Bluehost, SiteGround, InMotion are some of them who provide automatic backup facilities.]
Another great thing about running WordPress on localhost is that your test site will run much faster than what it would have run online. A localhost install of WordPress is also more secure and creates an ideal testing environment on your PC/computer. And this can be done by installing WordPress on XAMPP.
For this tutorial, we would be using XAMPP Version 7.2.1 the newest version as of January'2018 and Windows 10. So here is an updated guide on how to install WordPress on XAMPP in Windows Platform. This guide would also cover some tricky part on XAMPP setup, such as information on how to configure windows firewall for XAMPP and work around of port issues.
What is XAMPP?
XAMPP stands for (X) cross-platform, Apache, MySQL, PHP, and Perl. It’s a simple, easy, and lightweight application package that lets you create a local web server for testing purposes.
Although in this tutorial we are using XAMPP on Windows, XAMPP is a cross-platform application. It also works on Linux and MAC. You can go to XAMPP Download page and download for your desired Platform.
WordPress also can't run as a stand-alone application and requires server software at the backend. In this case, XAMPP can provide the necessary backend environment required to run WordPress on a local machine or localhost. It has all the required components such as Apache, PHP, MySQL, and phpMyAdmin that are required to setup WordPress locally.
This tutorial has Four broad sections:
Installing XAMPP on Windows:
Installing XAMPP on Windows is one of the primary requirements of this tutorial. A step by step guide is given below:
Step 1 - Download & Install XAMPP:
Download The Installation file from the download section of Apache friends Website. The size of the current version (7.2.1) is 122 MB.
Step 2 - Run the Installer:
Run the Installer to start the setup wizard. While starting the install process, you may receive warnings from Windows asking you if you’re sure you want to install the software or from your antivirus software. Just accept those warnings, in the same way, you do while installing any other software on Windows.
The XAMPP setup wizard will now start, just Click Next.
Step 3 - Selecting XAMPP Components:
The next window will appear and will be asked to select the components of the XAMPP software you would like to install. As we would be installing WordPress locally in a localhost environment, we would require Apache, PHP, MySQL, and phpMyAdmin to be installed. Just select these four components and uncheck rest of the options to minimize the installation size.
Step 4 - Choose the Installation Path:
Next, choose the folder where you would like to install XAMPP on your machine. I’m going to install it in C:\XAMPP. Then Click Next.
Step 5 - Install Bitnami (Optional):
In the next installation window, you’ll be shown a message asking for if you want to install Bitnami for XAMPP. Bitnami is a software Auto Installer, same like MOJO Marketplace or Softaculous but works on top of XAMPP.
Since in this tutorial we would install WordPress manually, we don't require it. Hence uncheck the “Learn more about Bitnami for XAMPP” and click on Next. The software installation will begin now.
Step 6 - Run Final XAMPP Installation:
The unpacking & installation process is quite lengthy and can take up to few minutes to complete. So be patient. I’m not attaching that screenshot to reduce few bytes of webpage size.
Once installation completes, you’ll be asked whether you would like to start the XAMPP Control Panel right away. XAMPP Control Panel is the interface from where you can control the XAMPP to run your localhost environment. Leave this option ticked and click Finish to open the control panel.
Configuring & Troubleshooting XAMPP on Windows:
This is the most critical part of this tutorial. I know many of you would get stuck after installing XAMPP as the application would not run on most of the PCs without configuring the Windows services and firewall. Hence I’m detailing those steps:
Step 7 - Open XAMPP Control Panel:
If you selected the option on the last step of installation, the Control Panel will automatically open. If you somehow unchecked the option then you have to go to the Start menu to open the XAMPP Control Panel. Alternatively, you can go to the XAMPP folder (C:\XAMPP in our installation) on your computer and open XAMPP Control Panel.
If the installation process was successful then the control panel will open with blue and black text updates at the bottom. If there is any issue while running XAMPP, then it will show updates in red.
Step 8 - Troubleshooting Apache Port Error:
Now you may sometime see red errors like the one shown above, showing the posts that XAMPP is trying to use are not available. If you see this error you must follow the steps given below:
The main reason why XAMPP shows errors like this is due to another program on your machine using ports 80 or 443 (Required for Apache and MySQL).
In Windows 10, it mainly shows the error due to the TCP port 80 is blocked by World Wide Web (WWW) Publishing Service. This WWW Publishing service is used by Internet Information Services (IIS) and comes pre-installed. To run XAMPP you must stop the service from running on your machine.
- To stop the service running, follow the steps given below:
- Go to Start, and in the "search programs & files" field, type in “services.msc” and select the best match.
- Scroll down in the Services window until you find World Wide Web Publishing Service,
- Right-click on it, go to properties, select "Disable" from the drop-down, hit the stop button, and then click Apply or Ok.
- This should now free up TCP port 80. Restart the XAMPP application and it should run without errors.
If that doesn’t resolve the issue, then you windows firewall must be not configured properly. To set up a new firewall rule to unblock the port follow these steps:
- Go to Windows Control Panel, Open Windows Firewall, Then click on Advanced Settings on the left
- Click on "Inbound" on the left, then on the far right click "New Rule"
- Click on Port and then on TCP. In the field below for Specific Ports type “80, 443” and click on Next.
- Check "Allow the Connection" then click on Next
- Make sure all options are checked and click on Next button.
- In the name field, enter any name you want, and Click Finish
- Repeat Step i to vi, but this time click on "Outbound" in step ii.
- Restart your computer
Now Ports 80 and 443 should now be open locally on your computer.
Please note that if you get any security/firewall warnings while installing or using XAMPP (example as shown below), make sure you check “Private networks" and click on “Allow access”. This is a very important step as if you cancel/don't press the "Allow access", XAMPP would not work.
Running XAMPP on Windows:
Now as the firewall and Apache port issues are configured and fixed, it’s the time to run XAMPP on windows:
Step 9 - Starting XAMPP on Windows:
Now, when everything is configured, let’s see if everything works smoothly.
Restart XAMPP and open XAMPP control Panel. Then start up both Apache and MySQL server.
Step 10 - Check Application Status:
If the applications start successfully then they will turn green as shown below.
Step 11 - Check XAMPP Status in Browser:
Now you can check the status of the XAMPP service by opening a web browser and type in:
http://localhost/
If XAMPP is running perfectly, then it will show something like the below:
Installing WordPress Locally on XAMPP:
Now the final section comes up, to install WordPress Locally on XAMPP. The process of installing WordPress on XAMPP is more or less same as installing WordPress Manually using FTP, except some of the steps like setting up database and file copy locations. We have a detailed tutorial on installing WordPress manually if you like to read so. In some of the steps, there may not be any screenshots; those can be found on in the article: How to install WordPress manually in cPanel using FTP.
Step 12 - Download WordPress & Creating Website Folder:
Download & Unpack the WordPress Installation files from the WordPress.org's Official Download page.
Then go to the “htdocs” subdirectory of C:\XAMPP folder, and create a new folder with a name you want to give to your site (here I’m creating “yoursite”).
Step 13 - Copy WordPress Files:
One created copy those unpacked WordPress Files under this folder.
Step 14 - Open phpMyAdmin in XAMPP:
It’s now time to create a MySQL database to use with WordPress, to do that go to the phpMyAdmin panel from XAMPP control panel by clicking the “Admin” button under MySQL.
Step 15 - Create MySQL Database:
When phpMyAdmin panel opens, go to databases. Under create database section give a suitable database name that you can remember and click on “Create”.
Step 16 - Run & Install WordPress on XAMPP:
Run the WordPress Installation by opening a browser and type the desired URL, i.e.- http://localhost/<folder_name>. And your WordPress Installation Will Start.
In my case it is http://localhost/yoursite/
Step 17 - Provide WordPress Database Information:
Now the Only Step differs from our previous tutorial on installing WordPress manually is the Database Name, Username, Password, and database Host field:
Here you have to put the below parameters:
- Database Name: The database name you created.
- Username: root
- Password: Leave this field blank (nothing to write)
- Database Host: localhost
Step 18 - WordPress Installation Complete:
Complete rest of the procedure and your WordPress site would be ready to work on the XAMPP software.
[I know I have skipped some steps while installing WordPress on XAMPP, those steps are same as manual WordPress installation. If you are facing issues or unsure about rest of the installation process, then follow Step 6 through Step 11 of How to Install WordPress Manually]
Now if you access the website URL (http://localhost/yoursite/) you should get the screen like below:
The Conclusion and Final Thoughts:
XAMPP provides an easy way to run a local server environment on your Windows/Linux/MAC machine, enabling you to test and develop locally, eliminating the need of installing WordPress on a live site. It will also save you a bunch of time while giving you an easy and safe channel to test different themes and plugins.
The greatest thing about XAMPP is its completely free and open source. You can set up as many installations of WordPress as you wish.
We hope that you have enjoyed the above article about installing WordPress Locally on XAMPP or on a PC/Windows. Be with us to explore free training on Leading Technologies and Certifications.
Leave us some comments if you have any question or facing any issue with the XAMPP & WordPress installation, we would be definitely helping you out.
If you like our articles please like our facebook and twitter page to receive notifications on recent and updated contents.