Setting Up WordPress On Localhost
In the previous blog post, we got an insight into the website creator tool called WordPress, and its features. But can you install it on your computer? Yes, you can, let me tell you how.
Setting up XAMPP on your Windows machine is by far no easy feat! However, once it’s installed, it’s a piece of cake to run and will save you a whole lot of time if you need to run WordPress locally.
Advantages Of Setting Up Localhost:
The great thing about running a localhost install is that your test site will run much more quickly than it otherwise would online. But be sure to install and activate Hummingbird on your install if you want to ensure it continues to run at optimal speed. Another positive feature of a localhost install is that it is more secure and provides an ideal testing environment on your computer, away from prying eyes or hackers, making it perfect for a workplace. Right now XAMPP 5.6.31(for PHP 5.6) & XAMPP 7.0.22(for PHP 7.0) are now available and Windows itself has undergone a few updates.
What is XAMPP?
XAMPP stands for cross-platform, Apache, MySQL, PHP and Perl. It’s a simple and lightweight solution that allows you to create a local web server for testing purposes. Since XAMPP is cross-platform, it also works on Mac and Linux, but today let us focus on how to set up XAMPP on Windows 10.
WordPress isn’t a standalone application and requires server software in order to run. XAMPP provides the necessary environment needed to run WordPress on a local machine. Let us now learn how to install XAMPP.
How To Install XAMPP:
Go to the Apache Friends website and download XAMPP. The XAMPP file is approx. 109MB.
Once downloaded, launch the installer.
- The XAMPP setup wizard will guide you through the installation. Click Next.
- In the next window, you will be asked to select which components of the software you would like to install and which ones you don’t want.
- It is up to you which components you want to install. Since we want to run WordPress in our localhost environment, it is best to leave MySQL and phpMyAdmin checked and the remaining options unchecked.
- Next, select the folder where you would like to install XAMPP on your machine. For example, C:\Program Files\XAMPP.
- In the next window, you’ll be asked whether you would like to install Bitnami for XAMPP, which offers free tools for installing WordPress, Drupal, and Joomla! on top of XAMPP. You can make your choice and tick it.
- After going through all those initial installation steps, XAMPP is now finally ready to install. Click Next.
- Once installed, you’ll be asked whether you would like to start the XAMPP Control Panel, which provides an interface for running your localhost environment. Leave this option ticked and click Finish.
- The Control Panel will automatically open, but if you unchecked the option in the previous window, you can go to the XAMPP folder on your computer and open XAMPP Control Panel instead.
Congratulations, you have successfully installed WordPress on localhost! But here too, unfortunately, we might face some problems. How can we solve those?
Fixing Port Errors
One main reason why XAMPP throws up errors is due to another program on your machine using ports 80 or 443 – the ports Apache and MySQL need in order to run.
If you’re using Windows 10, World Wide Web Publishing Service is most likely using port80. This program, which is for Internet Information Services (IIS) for Windows® Server, comes pre-installed and if you’re not using it, you can simply stop the service running on your machine or even delete it.
To stop the service running, do the following:
- Go to Start, type in “services.msc” and select the best match.
- Scroll down in the Services window to find World Wide Web Publishing Service.
- Right-click on it and select Stop.
- This should free up port 80. When you restart XAMPP it should run without errors.
If that doesn’t resolve the issue, you can set up a new firewall rule to forcibly unblock the ports:
- Open Windows Firewall on your machine and click on Advanced Settings on the left.
- Click on Inbound on the left, then on the far right click New Rule.
- Click Port and then TCP. In the field below for Specific Ports type in “80, 443” and click Next.
- Check Allow the Connection then click Next.
- Make sure all options are checked and click Next.
- In the name field, enter whatever you want. Click Finish.
Now repeat all steps, but name this new rule something different and click Finish.
Restart your computer.
Ports 80 and 443 should now be open locally on your computer.
I must also mention at this stage that if you get any security/firewall warnings while installing or using XAMPP, make sure you check “Private networks, such as my home or work network” and click “Allow access.” This is very important. If you don’t allow access, XAMPP won’t work.
You can check if your new local server is installed by visiting http://localhost in your browser.
Setting Up Your MySQL Database:
Before we install WordPress, we need a database.
- In your XAMPP Control Panel, click the Admin button in the MySQL section.
- A new browser window will automatically open with the phpMyAdmin interface.
- Click on Databases near the top-left, and you’ll be prompted to create a new database.
- When you’ve entered a name, click Create and close the window.
Thus, the process is done! The great thing about XAMPP is it’s free and open source. You can set up as many installations of WordPress as you want and it’s just as easy to get Multisite up and running.