If you are a routine website developer, installing WordPress on your local machine can be very useful. It helps you test new features such as themes and plugins without interfering with the live site. Moreover, running your site in a local server environment allows you to learn WordPress development without the fear of messing up things. In this article, we will learn how to install WordPress and set up a website locally using XAMPP.
What is XAMPP?
To run a WordPress site locally, you need to have web server software (Apache, PHP and MySQL) on your PC. Installing each software independently is both tedious and time-consuming. XAMPP is a cross-platform that installs Apache distribution with MySQL, PHP and Perl. It is lightweight localhost that enables you to develop WP sites locally. Besides, XAMPP is available for various OS including Windows, Linux and macOS.
1. Download and Install XAMPP on Your PC
Downloading XAMPP is free and straight forward, but you need to select the right version for your system. Visit the Apache Friends website and click the download link for your platform.
Run the downloaded file to launch the XAMPP installer. Depending on your system settings, you may receive warning prompts. Continue through the prompts to open the setup wizard. Click the “Next” button on the setup screen to continue with the installation.
The resulting window allows you to select components that you would like to install. Since you need XAMPP to run local WordPress sites, you can check MySQL and phpMyAdmin only. Note that, you cannot uncheck PHP and Apache as both are basic components for running XAMPP.
Next, you will need to select a folder where you want to install XAMPP. You can choose a folder or leave it as default and then click “Next”.
On the next screen, the installer prompts whether you want to install Bitnami, a free tool that offers free installers for WordPress, Joomla and Drupal. Since you want to install WordPress manually, uncheck the option and continue.
Now the setup is ready to install XAMPP. Click “Next” to start installing and wait for a few minutes to complete the installation. Once it finishes, check the option for starting the control panel and click the “Finish” button.
2. Starting Modules and Testing XAMPP Server
If the XAMPP was installed and everything is running properly the updates text at the bottom of the control panel will be in blue and black. Any issues are indicated in red text. You can now start the modules:
- Click on the “Start” button next to “Apache” and “MySQL” modules.
- If you get firewall prompts, click “Allow Access” for both modules to run on your PC.
- You will notice a green colour highlighting both names when they start successfully.
- On your browser, visit http://localhost to test the XAMPP server.
3. Setting up a Database for WordPress
Before you create a local WordPress site, you should create a database with MySQL.
- To do so, click the “Admin” button for the “MySQL” module to launch the phpMyAdmin page on your browser.
- Click the “New” option on the left panel of the phpMyAdmin dashboard, type a name for the database and click “Create”.
4. Download and Add WordPress Files to XAMPP
Visit the WordPress official website and download the latest version of WordPress. Now open the zip file, extract and copy the “wordpress” folder (contains the WordPress files). Navigate to the folder where you installed XAMPP (C:\xampp for our case). Open the “htdocs” sub-folder and paste the “wordpress” folder; you may rename the folder.
This will be the sub-name for accessing your local WP site i.e. ‘http://localhost/mysite’ if you renamed the folder to “mysite”.
5. Installing WordPress with XAMPP
Now visit your local site from the browser using the URL, ‘http://localhost/[wordpress_foldername]’ and click “Let’s go” to configure. Enter the database details as follows:
- Database name: the name of the database you created in step 3 above.
- Username: type ‘root’.
- Password: leave the password field blank.
- Database Host & Table Prefix: leave the default settings and click “Submit”.
On the welcome, click the link to run the WordPress installation. Fill in the WordPress site details in the next page and click the “Install WordPress” button.
After successful installation, your local WP website is ready for use. You can now log in to the admin dashboard and start building your site.
XAMPP offers a local server environment to enable you to develop WordPress websites locally. This allows you to learn and test various features like plugins and themes without breaking the live site.