WordPress is the most popular content management system for launching all types of websites. However, it’s no secret that the software is equally useful for web testing itself. In this case, we recommend installing WordPress locally rather than on a web hosting plan.
This article explains how to perform WordPress localhost installation in six easy steps. We will use XAMPP localhost software as it is free and supports various operating systems.
First, let’s explore how a WordPress localhost version works and different ways to get a local hosting WordPress website.
Why install WordPress on Localhost?
When installing WordPress locally, the complete website is placed in a localhost environment. The website establishes a connection to a local machine using the loopback address network instead of going over the internet, hence the term “local”.
A localhost WordPress website allows developers and web designers to test features before implementing them on a live website. As a result, you can fix any bug immediately without affecting user experience.
Users who want to learn more about web development can also benefit from this version of WordPress. You can create a copy of a live site on your own computer and experience it without having to purchase a hosting plan or domain.
How to Install WordPress on Localhost
Various local server software options are available to create a local WordPress site. In this step-by-step tutorial, we will use XAMPP ‒ The most popular cross-platform web server for PHP development.
1. Download XAMPP
Go to official Apache Friends Website and download the correct version of XAMPP software according to your operating system.
2. Install and run XAMPP on your computer
Run the XAMPP installer and follow the installation guidelines using the default settings. If you see a pop-up indicating that your antivirus software may be affecting the installation process, click Yes Continue.
After installation, run XAMPP application and configure the environment. In the XAMPP control panel, start apache and mysql modules to perform WordPress localhost installation.
If you are using the Windows operating system, you may encounter the localhost refused to connect error. Temporarily disabling your firewall or stopping the program that is using port 80 should fix this problem.
3. Download WordPress
Once the server is up and running, the next step is to install WordPress. Download the Latest version of WordPress then extract the ZIP file.
Navigate to your XAMPP folder in drive C (C:\xampp) and locate the htdocs case. Upload the extracted WordPress files there. We recommend renaming the new folder with your website name for easier web development on the XAMPP server.
4. Create a local database
Go back to your XAMPP control panel and select the Administrator button of the mysql module to launch phpMyAdmin – an administration tool for managing MySQL and MariaDB databases. It will help to create a local MySQL database.
Open the Data base and enter the database name in the tab Create a database section. Set the drop-down menu value to Snack and hit it Create button. Your new MySQL database should appear in the left sidebar of the webpage.
5. Install WordPress on Localhost
Complete the installation of WordPress locally by visiting http://localhost/foldername through your browser. Remember to replace the “folder name” placeholder with the name of the folder you chose in step three.
WordPress requires a list of information to create the localhost site. Fill the database information as given below:
- Name of the data base ‒ the name of the database you created in phpMyAdmin.
- username ‒ enter “root” as the default user name.
- Password – leave the MySQL database password field empty.
- Database host ‒ keep the default “localhost”.
- Array prefix ‒ keep the “wp_” by default.
When finished, press Submit -> Run the installation. Fill in the necessary additional information, such as site name and login credentials, then click the Install WordPress button.
Pro tip
If you are using Windows or Linux, WordPress will automatically store this information in the wp-config.php file. WordPress will provide macOS users with a code snippet to replace the contents of the existing PHP wp-config file.
6. Check the local site you created
That’s it – your website is now ready. Go to http://localhost/foldername/wp-admin and use the login credentials you created in the previous step to access the WordPress dashboard.
Conclusion
Running a WordPress installation requires a hosting plan and domain name. However, if you only need it for testing or learning purposes, installing the CMS on localhost and storing all data locally should suit your needs just fine.
Here is a recap on how to install WordPress on a localhost environment:
- Download XAMPP.
- Install XAMPP on your computer.
- Download the latest version of WordPress.
- Create a local database in phpMyAdmin.
- Install WordPress on localhost.
- Check the local test site through your browser.