Having a local installation of WordPress on your computer can be incredibly useful for website testing and development. WordPress developers and website owners frequently install WordPress locally on their computers to test new releases, themes, plugins, and code updates before using them in production.
In this article, I will show you how you can create a local WordPress environment using a free application called XAMPP.
Why Install WordPress Locally?
You may be wondering why anyone would go to the hassle of installing WordPress on their computer. After all, would it not be quicker to just install updates on your live website and save yourself time? Performing updates directly on your live WordPress website will indeed save you time initially, but as any experienced WordPress user will tell you, doing so is risky. There is always a chance that upgrading to a new version of WordPress, or updating a theme or plugin, will crash your website.
Here are the most frequent reasons why people are installing a local version of WordPress on their computer:
- Testing – A local WordPress installation allows you to safely test upgrades, tweaks, and other customizations.
- Website staging – Your local WordPress website can be used as a WordPress staging site. Once you have made the modifications you want, they can be pushed to your live website.
- Development – A local version of WordPress is the perfect environment to create and modify WordPress themes and plugins.
- Offline access – It can be useful to set up a test WordPress website online that can be accessed from anywhere; however a local installation of WordPress does not need an internet connection. Therefore, you can access your local installation if your connection goes down or if you are travelling and do not have access to the internet.
- Security & privacy – A local WordPress installation is only accessible to you on your computer. This is significantly more secure than a WordPress website that is installed online.
- Speed – Local WordPress installations run quicker than their online counterparts.
As you can see, there are many benefits to setting up a local WordPress installation. You will be glad to hear that setting one up is a relatively straightforward process.
What Is XAMPP?
To run WordPress, it is recommended that your environment includes:
Each of these open-source applications can be installed separately on your computer, however, it is time-consuming to do so. In contrast, XAMPP installs everything you need to run WordPress. Besides, you can use it to create local installations of other website solutions such as Joomla, Drupal, PrestaShop, PHPBB, and OpenCart, too.
The name XAMPP is an acronym of cross-platform (X), Apache (A), MariaDB (M), PHP (P), and Perl (P). XAMPP is “cross-platform” because it works on multiple operating systems. The four applications installed by XAMPP unlock many possibilities for website owners and developers.
I believe most WordPress users will be comfortable using the XAMPP installer, however if you have any problems you can find help in XAMPP's community forum.
Install XAMPP on Your Computer
You can download XAMPP with different versions of PHP for each operating system. It comes with multiple add-ons that let you install popular applications on top of XAMPP — we will speak about them later in the article.
For the purpose of this tutorial, I installed the PHP 7.3.7 version of XAMPP on my Windows laptop. The process is the same for Linux, Mac, and Solaris users; although the layout of the control panel varies by operating system.
To start the installation process, download the XAMPP version that best fits your needs, then double-click the .exe file.
In the next step, you need to select the server and program language components you want to install. All components are selected by default.
Now, you need to define the location of the installation folder where XAMPP (and later your WordPress site) will be installed.
In the next step, you can find a short note about the Bitnami application. I will speak more about how you can use Bitnami to install WordPress later in the article.
Once you have completed the configuration steps, you can begin to install XAMPP.
It only takes a minute for XAMPP to unpack all files and install them on your computer.
XAMPP may get flagged by anti-virus software, so be sure to give it access.
Congratulations! XAMPP has now been installed! Now, you can start the XAMPP control panel in your Windows desktop.
The XAMPP control panel can be loaded in English or German.
The control panel may be a little daunting at first, but it is simple to use once you know where everything is.
At the left, you will see the module components that you installed. At the right, you can find their corresponding actions: Start, Admin, Config, and Logs. The admin action buttons will be greyed out until the belonging modules are running.
At the far right-hand side, there are links to useful functionalities such as the control panel configuration area, Netstat utility tool, command shell, file explorer, and services.
From start to finish, the download and installation process of XAMPP should only take you a few minutes.
In the following sections, I will show you how to install WordPress locally using Bitnami and how you can install WordPress manually. In both of these methods, you need to start up the Apache and MySQL services. To do that, all you have to do is clicking on the start buttons for each module.
Now, XAMPP will remain in your Windows taskbar unless you quit the app. By right-clicking the XAMPP icon, you can switch modules on and off. You can quit XAMPP from here, too.
You can check if your server is running correctly by typing localhost into the URL bar of your browser. When you do so, you should see the XAMPP welcome page that includes the technical details of your installation.
Now that XAMPP has been installed and the Apache and MySQL modules have been started, you can install WordPress, too.
Install WordPress Using Bitnami
Bitnami is an application package solution that simplifies the process of installing popular open-source applications. The company was acquired by VMWare in May 2019; though the founders of Bitnami have confirmed it will continue to be supported.
XAMPP encourages users to use Bitnami by promoting the application during the XAMPP installation process and also as an “All-in-one tool” on its add-ons page.
You can download the Bitnami WordPress module from the Bitnami Modules for XAMPP page. It is available for Windows and Linux. At the time of this writing, the module is not available for other Unix systems, but it works with OS X if you use XAMPP-VM instead of XAMPP.
Once you click on the Bitnami WordPress installation file, you will be asked which language you want to install WordPress in. The available languages are English, Spanish, Portuguese, Simplified Chinese, Korean, Hebrew, German, Romanian, and Russian.
Now, you can click through the Bitnami WordPress module setup wizard.
In the next step, you need to select the folder where XAMPP has been previously installed. If you did not change the default installation folder for XAMPP, Bitnami will correctly list your XAMPP installation folder.
Bitnami will create your WordPress admin account now. All you need to do is enter your username, real name, email address, and password.
In this step, simply enter the name of your WordPress installation.
Now, you can enter your SMTP connection details. You can choose from two options: Gmail and custom email provider.
If you select Gmail, you need to enter your Gmail address and password. If you select custom, you will need to enter all the SMTP connection information that is provided by your email provider.
The next step displays an advertisement for Bitnami Cloud. If you leave the checkbox checked, it will open up their information page that explains the benefits of hosting your WordPress website with them through cloud services such as Google Cloud and Amazon Web Services.
Bitnami will now install WordPress on your Windows PC.
It only takes a minute or so for the necessary files to be installed.
Congratulations! You have just installed WordPress locally on your computer using Bitnami!
The last step of the Bitnami WordPress installation wizard asks you to launch the Bitnami WordPress module. Doing so will open the front-end of your new WordPress website.
My new website is accessible locally at the http://127.0.0.1/wordpress/ URL.
As you would expect, the admin area for my new WordPress website can be found locally at http://127.0.0.1/wordpress/wp-admin/.
Bitnami installed WordPress into the XAMPP apps folder at C:\xampp\apps\wordpress. You can find all WordPress files within the htdocs folder.
As you can see, the process of installing WordPress locally on your computer using XAMPP and Bitnami is a breeze. The software does everything for you.
I believe this is the method most WordPress users should choose when installing a WordPress website locally on their computer.
Set Up WordPress Manually in XAMPP
Bitnami is undoubtedly the simplest way to install WordPress in XAMPP, however it is also important to know how to manually install WordPress. Those of you who have already installed WordPress manually on a live website will be familiar with the process.
There are three steps to installing WordPress manually with XAMPP:
- Create the WordPress database.
- Download WordPress.
- Install WordPress.
Let's move on and create the WordPress database.
1. Create Your WordPress Database
You can create your WordPress database in the phpMyAdmin application that has been installed together with XAMPP. To access phpMyAdmin, simply click on the admin button for the MySQL module.
The phpMyAdmin application will load up in your browser.
Click on the “Databases” tab, enter a name for your WordPress database and then click on the “Create” button. You can call the database anything you want, but be sure to remember it for the WordPress installation wizard later.
In contrast to installing WordPress in a live setup, you do not need to create a database user when using XAMPP (although you still can if you wish).
2. Download WordPress
WordPress can be downloaded directly from https://wordpress.org/download/. After downloading the installer, extract the ZIP file to unpack the WordPress folder.
Next, go to the htdocs folder within your main XAMPP installation folder. In Windows, if you did not change the location of the XAMPP installation folder during setup, the htdocs folder will be located at C:\xampp\htdocs\.
Create a new folder for your local WordPress site within this folder. I called mine mylocalwordpress, but you can use any name you like. You need to copy the contents of the WordPress folder you extracted from the ZIP file into this new folder. In my case, it's C:\xampp\htdocs\mylocalwordpress\.
You now have everything in place to install WordPress locally.
3. Install WordPress
It is now time to install WordPress.
If you wish, you can install WordPress by adding your database information to the wp-config-sample.php file and renaming it to wp-config.php. It is, however, much easier to run WordPress's famous installation wizard; and you can always modify the wp-config.php file later if necessary.
To run the WordPress installation wizard, you need to access your new WordPress website. Remember the folder you created in htdocs previously? The name of this folder is used as your WordPress website location.
So, you can access your WordPress website at http://localhost/yourwebsitename/. For instance, in my setup, I had to visit http://localhost/mylocalwordpress/. When you visit your local installation URL, you will be presented with the WordPress installation wizard (located at http://localhost/yourwebsitename/wp-admin/setup-config.php).
In the first step, you can select your website language from the dozens WordPress has been translated into.
In the next step, the installer reminds you that you will need your database connection information for the wizard.
Now, you need to enter your database connection details. Enter your WordPress database name, database username and password, database host, and the table prefix you want to use for your WordPress tables.
Your database name is the name of the database you created in phpMyAdmin. If you have forgotten your database name at this stage, you can log back into phpMyAdmin from the XAMPP control panel and see it there.
The database username should be set as root and the password field should be left blank. Database host should remain as localhost. You can also change the table prefix if you wish. This is worth doing if you are planning on creating multiple WordPress websites in your local environment.
Next, you are asked to run the WordPress installation wizard.
You can now enter the name of your new WordPress website, your administrator username and password, and your email address. This page also has an option to discourage search engines from indexing your website; though that is not applicable now since your website is offline.
When you are ready, click the “Install WordPress” button.
WordPress has now been installed on your computer and you can log in to your new website.
The Bitnami WordPress installation wizard directed you to the front-end of your website. The manual WordPress installation procedure will, instead, take you to the admin login page so that you can enter your WordPress admin area at http://localhost/yourwebsitename/wp-admin/.
You can now start using your local WordPress website.
Although the Bitnami WordPress module simplifies the installation of WordPress, installing WordPress manually using XAMPP is far from difficult.
The Bitnami installation method saves you from having to create your WordPress database in phpMyAdmin and downloading the latest version of WordPress from WordPress.org. However, if you install WordPress manually you get more control over how things are set up.
The choice is yours.
I hope you have enjoyed this tutorial on how you can create a local WordPress website on your computer using XAMPP.
A local WordPress website is something which WordPress users can use for testing, website staging, development, and more. Whether you install WordPress manually or use the Bitnami WordPress module to simplify the installation process, I am sure you will be able to follow the above steps.
It is worth noting that some applications, such as Skype, can conflict with XAMPP because Apache uses port 80. You will find tutorials online on how to resolve this issue, though if you do face this issue, it is normally quicker to uninstall XAMPP and install it again. Good luck.