How to Install WordPress on Localhost XAMPP (2024 Update)

Do you want to install WordPress on XAMPP localhost? Installing WordPress on localhost XAMPP means running your WordPress website on your computer without posting it on the internet. Installing WordPress on localhost gives you the chance to test themes and plugins, and also learn about WordPress development.

In this article, we’ll discuss the importance of running WordPress on localhost and show you how you can run WordPress on localhost. So, let’s get started.

Why would you run WordPress on localhost?

Installing WordPress on localhost is actually a common practice among developers and people who are learning WordPress. Using this method, you don’t have to go through the trouble of buying a domain & hosting. Local WordPress gives you the freedom to perform various tests before making it live online.

Although you do need a domain name for your website and also hosting services to make it online. However, if you make your WordPress site live without customizing it, it puts a bad impression on your site if people visit. You might have heard the term ‘XAMPP WordPress’, which actually means building your WordPress site on localhost using XAMPP.

Big companies and professional WordPress developers also follow this method. For all of their projects, they create a local host and make changes there. After that, they upload those changes on the live server. This is much safer and also faster. So if you are a professional developer or learning WordPress development, this is a good practice.

An important side note: You might already know this, but it’s still important to mention that the local WordPress website is not visible on the internet or to others. If you want to make your website live, then you have to purchase a domain and hosting for your WordPress website.

With that being said, let’s first understand what XAMPP is and why we need it to install WordPress locally.

Get Latest Post Notifications!

Subscribe to our newsletter

What is XAMPP?

XAMPP is a software package that contains all the applications you need to setup and run WordPress locally on your computer.

WordPress mainly needs 2 things to run, a server and a database. WordPress is created with PHP, which is a server-side programming language. Now, your browser doesn’t understand raw PHP code unless it is first compiled through a server. WordPress also needs a database to operate. Using a database WordPress keeps track of posts, users, usernames, passwords, and much more.

So, XAMPP provides all these things. It uses Apache, an open-source server architecture for your computer to provide your WordPress with a server. It also uses MySQL, which is a database management software. You can also use phpMyAdmin to create and manage your database.

Of course, you can install this software individually and run WordPress locally but why go through all that trouble when everything is taken care of by XAMPP? There are other applications like XAMPP, such as WAMP, LAMP, MAMP, etc. you can use any of these.

Now that you know how everything works, let’s run WordPress on localhost using xampp!

How to install WordPress on XAMPP localhost

To install WordPress on xampp localhost, we need 2 things:

  • XAMPP
  • WordPress

Before we install WordPress on XAMPP, we need to download the actual software. Once you have these, local WordPress installation becomes very easy. Let’s go through the steps.

Step 1: Download and install XAMPP on the desktop

Ok, so let’s download xampp first. If you can’t find the link, simply search on your browser “download xampp” and you should see the result on the first link which is from apachefriends.org. Once on the website, you’ll see the download links for Windows, Linux, and macOS. Select which operating system you’re on.

xampp download page

Clicking on the download links will download the latest version of XAMPP on your system. It is best to download the latest version of xampp as it uses the latest version of PHP. But if you’ve been working on an older version of PHP, then you can also download that version from this website.

After the download is complete, open up the file. It will launch the installer. You might see a warning message saying that because of a UAC on your system some functions of xampp might not function properly. But that generally doesn’t cause any problems. Click on ok and proceed with the installation.

xampp setup wizard

Click next, and XAMPP will ask you what services you would like to install. In order to run WordPress locally for general purposes, we only need Apache, MySQL, PHP, and phpMyAdmin. You can uncheck the other options if you don’t need them.

xampp components

Click on next and select which drive you want to install xampp in. By default C drive will be selected. You can change the directory if you want.

Important: You can only install one copy of xampp per drive. If you have more than one copy of xampp installed in one drive, you might face issues running WordPress locally.

After that, click on install and wait for a few seconds. When the installation is completed, you can visit the folder where you’ve installed xampp. In my case, I’ve installed it on my C drive. You’ll find the folder named “xampp”. 

xampp control.exe

Inside this folder, you’ll find many files and folders. For now, we are mainly interested in one, the “xampp control.exe”. Right-click on this file and select run as administrator.

running xampp as admin

This will open up xampp with admin privileges. Don’t get distracted by other options. We just need to start our Apache and MySQL services, the 2 essential things for running WordPress locally. Just click on start and both of the services should start normally.

running Apache and MySQL on xampp

Now if everything is working perfectly, we need to test it out. Open your browser, and in the URL bar type localhost and hit enter. If all went well, then you should see the XAMPP dashboard.

Apache dashboard

If you see the xampp dashboard, that means the Apache server is running smoothly. This ensures that your XAMPP is installed correctly and you can install WordPress on xampp. But we need to download WordPress now.

Step 2: Downloading WordPress

To download WordPress go to wordpress.org which is the official website. From there, click on the “Get WordPress” button in the upper right corner of the screen. After that, scroll down and you’ll see a download button that also mentions the WordPress version you’ll be downloading. Click on that button and wait for the download to complete.

You’ll find a compressed or zip file downloaded on your system. Now copy this file and go to C:/xampp/htdocs (or which directory you’ve installed your XAMPP in) and paste your file here. Then click on extract. After the extraction is completed, you’ll see a folder named “wordpress”. This folder has all the core files of WordPress.

Remember to put your core WordPress folder in “htdocs” inside xampp directory. Now our WordPress is nearly ready but still needs a database. So let’s create one using phpMyAdmin.

Step 3: Creating a database using phpMyAdmin

To create a database, go back to your browser, and from the localhost dashboard clicks on the phpMyAdmin link on the menu bar.

phpMyAdmin from Apache dashboard

Now, this should open up your phpMyAdmin. From here you can create, edit, delete, etc. your databases. Basically, you can manage all your database from this page. But for now, we need to create a new database for our local WordPress website. So click on the “Databases” tab.

creating a database in phpMyAdmin

Give your database a new name and click on create. It will quickly create a database for you.

Now we have a database, but it’s not connected to our WordPress website. In the older versions, you had to go into your local WordPress directory and access the wp-config.php file and change the database username and password. But there’s an easier process now. We’ll show how you can connect your database with your local WordPress.

Step 4: Installing WordPress on localhost

To connect your database with your WordPress website, simply type on your URL bar “localhost/wordpress”. 

Important: Here we are typing ‘wordpress’ because this is the name of our WordPress website inside the htdocs folder. If you want to run another website, simple copy the compressed wordpress file and extract it here but rename the folder from ‘wordpress’ to something else like “newblog”. Then if you want to launch that website you have to type in your URL bar “localhost/newblog”.

You’ll see a WordPress install page now. Select your language and click on “Next”. WordPress tells you that you need the following items:

  • Database name
  • Database username
  • Database password
  • Database host
  • Table prefix

We have all this information so click on “Let’s go!” to go to the next page. Here you need to input your database name, username, and password. So we named our database wpdatabase in phpMyAdmin. Use that exact name and for username, change it to ‘root’ (this is default for XAMPP). And for the database password, keep the field empty (default in XAMPP). Don’t worry about the other two fields. Click on submit.

connecting database with WordPress

Now our database is connected with our WordPress. If everything is perfect, then you should see another screen where WordPress is congratulating you and prompts you to run the installation. Click on “Run the Installation” to begin.

WordPress setup

On this page, you need to select a site title for your WordPress website. This is not the domain name or anything. Just the name that will appear in the place of the logo. You can change your site title later as well.

After choosing a site title, you need to choose a username and password for the administrator. Since this is on localhost, you don’t need a unique username and strong password. Just choose something easy and then input your email address.

Checking the “Discourage search engine visibility” will discourage the search engines from indexing your website. Although this won’t matter since your website is on localhost.

After that, click on Install WordPress and wait for a few seconds. Finally, when your WordPress is installed, it will bring the WordPress localhost login page. Or you can also simply type on your URL bar: localhost/wordpress/wp-admin to bring it manually.

WordPress login page

Now that you’re on the WordPress localhost login page, input the username and password you just created and click on “Log In”. And that’s it! You’ve Installed WordPress on XAMPP localhost all by yourself!

Things to do after installing WordPress on localhost

After you’ve logged into your WordPress dashboard normally what you would do is delete the unnecessary plugins and themes. Just click on plugins and you’ll see 2 plugins “Akismet Anti-Spam” and “Hello Dolly”. If you don’t need these you can remove them.

You can also remove unnecessary themes that you won’t be using. You’ll be currently using the Twenty Twenty-Two theme by default. Some other versions of Twenty-Twenty might appear and if you are not planning on using those, remove those.

deleting unused themes

Plugins and themes are a part of your website and take up extra space. So if there are unnecessary plugins and themes remove those to make your website lighter and faster.

The next step would be to install a new theme. You can browse the themes directory from the WordPress dashboard. You can also look for plugins from the dashboard as well. If you want, you can go to wordpress.org and browse themes and plugins from there.

We also have a video on this topic on our youtube channel. You can check it out if you want. You can also read this article if you prefer texts more.

Moving your WordPress site from localhost to live server

If you are planning on moving your WordPress localhost site to a live server, then it’s a good idea to check out some great domain & hosting plans. Although there is some free domain & hosting services those are not good for a professional environment.

In order to ensure the best performance for your WordPress website, choosing the right hosting plan is crucial. Without the proper hosting plan, your website won’t be smoothly accessible to your audience. Some of the best domain & hosting services for WordPress are:

  1. HostGator
  2. Bluehost
  3. Cloudways
  4. WP Engine
  5. SiteGround

We’ve also created a list of the best hosting services for WordPress. If you want, you can check it out to learn more about WordPress domain & hosting. Hopefully, it will help you decide the best plan for your WordPress website.

👉 Learn More: XAMPP vs WAMP – What to Use for WordPress Local Installation?

Conclusion

It is a good practice to start a WordPress project on localhost. It is also the safest because it allows you to test your themes and plugins without hampering the live site. Working on a live site directly might not be the best idea even if you are a seasoned developer. Because a new update for a plugin that you are using might conflict with other plugins or the theme that you are using.

So, for any updates or making any changes, make sure that you start your project on localhost. If you don’t have that project on localhost, download the files of that site and set it up on your computer. For that, you need to know how to access your WordPress files.

If you run into any trouble while installing WordPress locally, you can comment below and let us know. We will try our best to solve those issues. 


Disclaimer: This post may contain affiliate links and we may receive a small commission if you purchase something by following them. However, we recommend services/products that we believe good to serve your purpose.

Leave a Reply

Your email address will not be published. Required fields are marked *