How to Install WordPress Locally for PC/Windows with XAMPP

Setting up a local sever environment on your computer will save you a bunch of time if you regularly test or develop themes and plugins.

Not only will your local sites run much quicker than they would online, but you’ll also have a much safer testing environment away from a live site.

Having a localhost environment has dramatically improved my workflow and is even an important part of my WordPress working life. It’s such a waste of money using an online WordPress installation with a web host as a test environment!

This week we’ve looked at Mac solutions for local machines. Today we’re going to look at XAMPP for Windows, a free, popular and easy to install server environment application that’s open source.

Easily install XAMPP for Windows and run your own local server environment for WordPress.

What is XAMPP?

XAMPP stand 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 we’re going to look at setting up XAMPP on Windows 7.

WordPress isn’t a stand-alone application and needs server software to run. XAMPP provides the necessary environment needed to run WordPress on a local machine.

Installing XAMPP

Go to the Apache Friends website and download XAMPP.

Apache Friends Site
Download XAMPP from the Apache Friends website.

The XAMPP file is 125MB. Once downloaded, launch the installer.

You may receive warnings about installing the software on your computer. As you would when installing any software on Windows, use your best judgment.

The XAMPP setup wizard will guide you through the installation.

XAMPP installer
XAMPP setup wizard.

In the next window you will be asked to select which components of the software you would like to install and which one you don’t want. Some options, such as Apache and PHP are greyed out because they are essential to running the software.

It’s up to you which components you want and don’t want. Since I we want to run WordPress on this localhost, I’ll leave MySQL and phpMyAdmin checked and uncheck the remaining options.

XAMPP options
Choose the components of the software you want to install and untick the ones you don’t want.

Next, select the folder where you would like to install XAMPP. I’m going to create a new folder in C:Program FilesXAMPP.

XAMPP select folder
Select the folder where you would like to install 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. We’re going to install WordPress manually and without this promotional program, so untick “Learn more about Bitnami for XAMPP” and click “Next.”

XAMPP Bitnami
In this tutorial we’re going to set up WordPress manually, so untick this option.

After going through all those options, XAMPP is now ready to install.

XAMPP ready to install
Almost there…

Once installed, you’ll be asked whether you would like to start the Control Panel. Leave this option ticked and click “Finish.”

XAMPP Control Panel
Installation is quick and painless.

If you receive any security/firewall warnings during the installation process (such as the one below), 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.

XAMPP firewall and security
Allow access for Apache and MySQL to ensure XAMPP can run.

If you left “Do you want to start the Control Panel now?” checked during installation, the Control Panel will automatically open. If not, go to the XAMPP folder on you computer and open “XAMPP Control Panel”.

XAMPP Control Panel
The XAMPP Control Panel.

Start up both Apache and MySQL. If you have installed XAMPP properly, both components should run fine without any errors, however, if there are any other applications on your computer using the same ports as these modules then you need to quit the conflicting applications using the same ports and restart XAMPP.

XAMPP running smoothly...
XAMPP running smoothly.

You can check if your new local server is installed by visiting http://localhost in your browser.

XAMPP localhost
Localhost is now installed and working!

Setting Up Your MySQL Database

Before we install WordPress, we need a database.

On your XAMPP Control Panel, click the “Admin” button in the MySQL section.

MySQL admin
Click “Admin” to set up MySQL.

A new browser window will automatically open with the phpMyAdmin interface.

XAMPP phpMyAdmin
Click “Admin” to set up MySQL or go to “localhost/phpmyadmin” in your browser.

Click on “Databases” near the top-left and you’ll be prompted to create a new database. I’ve called mine “WP”. When you’ve entered a name, click “Create” and close the window.

XAMPP MySQL database
Quickly and easily set up a new MySQL database for WordPress.

Download and Install WordPress

Download the latest version of WordPress.

In order to get WordPress working with XAMPP we need to unzip WordPress to the right folder. Go to the XAMPP folder on your computer and open the htdocs folder, i.e. C:/Program Files/XAMPP/htdocs.

XAMPP folder
Go to XAMPP/htdocs folder on your computer and unzip WordPress there.

Unzip WordPress into its own folder and rename it whatever you like. For consistency, I’m going to call this installation of WordPress “WP” to match the name of the database I just created.

Install WordPress
My installation of WordPress is called “WP.”

Open your WordPress folder, find the wp-config-sample.php file and rename it wp-config.php. Open the file and scroll down until you see the following lines:

wp-config database details
Update your wp-config.php file with your database details.

These lines of code define the login details for your database. Replace “database_name_here” with the name of your database, which in my case is “WP.”

Replace “username_here” with “root” and leave “password_here” blank.

Save the file and close it.

Now we can get on with installing WordPress.

Open your browser and go to http://localhost/wp/

You should see the welcome screen for the famous five minute WordPress installation process.

Famous five minute install
Set up WordPress using the famous five minute install process.

Enter your details and click “Install WordPress.”

Your WordPress installation is now complete!

Setting up WordPress Multisite

Having Multisite setup on a local machine provides a great way to test themes and plugins in a Multisite environment, but also makes it a quick and easy to have multiple sites running at once.

Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:

Activate Multisite
Activate Multisite installation mode.

Open XAMPP and ensure your Apache and MySQL servers are running.

Login to your localhost site in your browser and under “Tools” you will now have a new option, “Network Setup.”

Network setup
Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.

Enter a name for your network and your email address, then click “Install.”

WordPress will prompt you to edit your wp-config.php and .htaccess files.

Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:

Multsite wp-config
Edit your wp-config file to get Multisite up and running.

Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.

Your .htaccess file should look like this:

Edit .htaccess

Edit your .htaccess file to complete your Multisite installation.

Multisite should now be enabled and working on your WordPress site!

Multisite network
Your Multisite network should now be up and running!

Summing Up

XAMPP provides an easy way to run a local server environment on your Windows machine, allowing you to test and develop locally, rather than installing WordPress online. It will also save you a bunch of time since you won’t have to install and uninstall WordPress each time you test themes and plugins.

The great thing about XAMPP is that it’s free and also open source. You can set up as many installations of WordPress as you want and it’s just as easy to set up Multsite.

Next week I’ll look at how to set up WAMP, another popular option for setting up a local server environment for Windows.

Do you use XAMPP? Tell us in the comments below.

63 Responses

    • Elite
    • 215
    • #419

    Great tutorial!

    Have you considered making a video showing how to set up MAMP PRO to work as a server so developers can show their “work-process” to clients without needing to upload the database and files to another server?


      Raelene Wilson
      • Post author
      • 8
      • #11533

      Thanks Mike!

      I haven’t considered that, but I’ll definitely keep it in mind.


    Thanks for this info on setting up WordPress. I have followed each step but obviously have a problem.

    When I get to:

    Now we can get on with installing WordPress.

    Open your browser and go to http://localhost/wp/

    I get an error message saying: Error establishing a database connection

    I have checked the name of my database, the .php file edits, just can’t seem to see where I have gone wrong. Any help would be greatly appreciated.

      Raelene Wilson
      • Post author
      • 8
      • #11533

      It looks like MySQL isn’t working properly. Are the database details in your wp-config.php file correct? Is the database name the same as the name you of the database you created in phpMyAdmin? Is the username root? And did you leave the password blank?


      When it says to leave password blank, you actually just delete password_here, leaving ‘ ‘ behind. Hope that helps.


    Database is named wp
    Folder in htdocs is named wp

    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘wp’);

    /** MySQL database username */
    define(‘DB_USER’, ‘ROOT’);

    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘ ‘);

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    everything seems to be right, but obviously isn’t


    Yes they were, but I just stopped them and started them again but got the same error message

    11:22:50 AM [Apache] Attempting to stop Apache (PID: 1576)
    11:22:50 AM [Apache] Attempting to stop Apache (PID: 5976)
    11:22:50 AM [Apache] Status change detected: stopped
    11:22:51 AM [mysql] Attempting to stop MySQL (PID: 7088)
    11:22:51 AM [mysql] Status change detected: stopped
    11:22:52 AM [Apache] Attempting to start Apache app…
    11:22:53 AM [Apache] Status change detected: running
    11:22:54 AM [mysql] Attempting to start MySQL app…
    11:22:54 AM [mysql] Status change detected: running


    Can I please tell you that the info in that post fixed my problem. I edited the “users” as per that post and I now have the WordPress installation screen.

    Hopefully I can follow the rest of your instructions above with no more problems. Thanks for your help


    Through the rest with all things looking like they work OK.

    Now the new task of learning how to create sites and import themes into WordPress. Do you have any recommendations? I have created sites using HTML/CSS but am totally new to WordPress.

    Thanks again


    Just to get started, I probably wanted to be able to import a theme (probably just a free one to practice) and then be able to customize. Need to practice finding my way around WordPress.

      Raelene Wilson
      • Post author
      • 8
      • #11533

      The best place to start is the WordPress Theme Repository:

      I’ll have to leave you there since we’ve now ventured outside the scope of this article. Good luck with WordPress! If you need any support, you may want to consider signing up for a WPMU DEV membership. Our support team are much better than me at helping out users :)


    Nice info explained in a well detailed way. I just installed Xampp and thinking that I had wp installed on Local host. After reading this I setup my test sites on Local host and started running them. Thanks a lot for the article.

    Ali Sajjad

    Thanks for the well explained, This improve my knowledge to install WP at localhost.

    But why it showing ftp credentials errors at uploading any theme or plugin?


    Thank you for explaining how to install wordpress and xampp locally!

    I have successfully installed xampp following your steps. I then downloaded the wordpress zip and extracted it in hotdocs folder under xampp, as you suggested. I also renamed the wp-config-sample.php to and then opened the file and edited the information for username, database, password. Then save. However, when I try to access http://localhost/nameofmydatabase the page doesn’t connect, the browser says url not found, error 404. I have even repeated the process of creating a new database first with xampp and then extracting wordpress again and editing the wp-config.php but I get the same error when trying to access the url.

    I don’t know if I have missed a step or if there’s another problem. Do you know how I can access the url to run wordpress?
    Thanks in advance!

      Raelene Wilson
      • Post author
      • 8
      • #11533

      It doesn’t sound like a database problem since you’re getting a 404 page. Are your servers running when you try to load your page? You need to make sure both your Apache and MySQL servers are running.


        Thanks for your quick reply!

        Yes, both of Apache and MySQL servers are running when I try to load the wordpress page.


    Now I am getting “error establishing database connection” even though MySQL and Apache are both running. I don’t know how to solve this :(


    Thanks for a great tutorial. Worked almost perfectly.

    I copied what was in your .htaccess and made the alterations to wp-config.php but they didn’t work. I found If you follow the wordpress instructions when clicking ‘Tools->Network Setup’ it works fine.

    Any recommendations on how we can sync the local wordpress site with a online website?

      Raelene Wilson
      • Post author
      • 8
      • #11533

      Hi James, you might want to try using Duplicator, a free plugin available at It’s great for migrating a localhost site to a web host.


    I need some help with the setting up.
    The installation is successful, but when I enter “http://localhost” I get error.
    I using WIn7 and I have IIS installed

    The error is:
    IIS 7.5 Detailed Error – 500.52 – URL Rewrite Module Error.
    Outbound rewrite rules cannot be applied when the content of the HTTP response is encoded (“gzip”).

    How I can fix this?



    I cannot seem to figure out why I am getting this error when I connect to localhost

    Object Not Found.

    I have followed the instructions here.

    Also, for some reason I am not able to download xampp or wordpress to program files and I am forced to download to the C:\ I get a warning that the folder is full or something like that, could that be making a difference?


    Hi, I am having trouble adding multiple sites to the page… I manage to add them but get the following:

    “Access forbidden!

    You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.

    If you think this is a server error, please contact the webmaster.

    Error 403

    Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15″

    I can access the original site but not any that I add… strangely even though they appear added when I click ‘add site’ I also get a message saying “There is no disk in the drive. Please insert a disk into drive \device\harddisk2\DR2″ I hit cancel/continue a few times and it goes away but does add the site to the list but doesn’t work anyway.


    Fabulous tutorial Raelene

    I’m currently using XAMPP but I’d like to update.
    Any advice on updating without losing the sites that I’ve already created?


    how do i fix this?

    Server error!

    The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

    If you think this is a server error, please contact the webmaster.

    Error 500

    Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15


    Wow, best tutorial to install Xampp and WordPress locally. I followed the instructions step by step and everything is OK. Thanks!


    Really gr8.. you’ve written in.. so simple and exact words.. really nice.. very good article.. thanx so much for this..


    Awesome how to, it really helped me. Thank you very much for putting int the work.

    Raelene Wilson
    • Post author
    • 8
    • #11533

    Any time. I’m glad you found this post useful.

    XAMPP can be a bit fiddly to set up (as evidenced by the comments here) so I’m glad you didn’t have any problems!


    How do you reload your php file if you used Notepad++ to edit? I don’t have a domain or host yet. Is that required to follow your steps?


    This is a great tutorial and I got everything set up with Multisite without an issue. Of course now here is where I get confused up:

    The sites I have already exist outside of this and the localhost was setup as an after thought as the sites got more involved and needed customization. I’m not sure where to put the files for the separate sites. Do you have a tutorial for that?


    Awesome article. I really need help though and am hoping someone can take a moment to help me. I’ve been working on this all day and am very frustrated. I followed the instructions to a T and recieve the error “object not found” ….requested URL is not found on this server. For sure I’ve spelled everything correctly. The only thing I can think of that might have goofed things up is at the step when you click “admin” on mysql to create a database…..well clicking “admin” didn’t open the browser so rather I went to localhost and selected the option to go directly into phpmyadmin. From there I created the database exactly as it was detailed in the article. I unzipped the wordpress into the htdocs folder and edited the wp-config file. I left the password blank, set root as admin, and specified the database I just created in phpmyadmin…..


    This is very good article for wordpress learner


    Hi, I’ve been able to download wordpress and xampp fine but am running into a bit of an issue.

    In order to use the full wordpress editing site, you need to have gone to http://localhost/wp/ and installed wordpress which creates a new website. However, is it possible to download wordpress and connect it with a local site? I moved all of my local web files to xampp/wp, and I can see the webpage fine when I go to localhost/wp, but the only way I can edit it is by editing the actual files (as opposed to using the much nicer wordpress site layout). I might be misunderstanding something, but is downloading wordpress to a local site possible?


    thank you for the info given above. You just helped me solve my problem with xaamp. Your post was more than precious to me, really.


    Most excellent post – Thanks for the great information and making it easy to get a local setup!
    I’ve followed your instructions for a multi install of wp sites and everything went well with editing the wp-config.php and htaccess –
    However when I log into WP admin, there are a whole lot of errors:
    (Just a sample):

    Notice: Trying to get property of non-object in C:\xampp\htdocs\WP\wp-includes\capabilities.php on line 1168

    Notice: Trying to get property of non-object in C:\xampp\htdocs\WP\wp-includes\capabilities.php on line 1169

    Notice: Trying to get property of non-object in C:\xampp\htdocs\WP\wp-includes\capabilities.php on line 1169

    Notice: Trying to get property of non-object in C:\xampp\htdocs\WP\wp-includes\capabilities.php on line 1172

    etc etc…

    Do you have any idea what they mean and how I can fix?




    I just want to say that this was so simple to follow. Being a web developer familiar with CSS/HTML but not much of anything else…this was a challenge I spent hours agonizing over.

    After finding this tutorial, it was such a blessing! <3

    As for those looking for a way to show a client progres…I use Skype ScreenShare. It (more often than not) works like a charm. I just clear all my windows, open all my clients project information, and BAM! Ready to go!

    Anyway, I really, really appreciated this.

    Would Multisite be how I eventually take the WP live?

      Raelene Wilson
      • Post author
      • 8
      • #11533

      I’m glad you found the post valuable. Having a localhost setup is definitely the best way to test themes and plugins.

      You don’t necessarily need Multisite. I really depends on what kind of site you’re setting up.


    Each time I try and download wordpress from any source the menus are in Spanish or latin1. How can I correct?

    How can I delete numerous databases I created, all with no tables, trying to get an English version?



    Could not have done this without you!
    In fact your Multisite edits to the config file work. What WP 4.0.1 tell you to add in the dialog box don’t! It’s flawed.


    Hi, thank you for this great information. Everything works perfectly except when I now go onto my sites>network admin. When I click on this it says object not found, also when I click on network admin> sites, it also says object not found. I want to add new sites besides my principal site but have no idea on how I’d do that.

    Please help.


    Hi! Thanks for the explanation! :) It help me alot!


    Raelene, it was a great tutorial. I followed each and every step but got stuck in the middle.
    When I type localhost/wp in my browser it shows “Database Error”, although I did everything stated in your tut. Oh, one thing I did change was rather installing XAMP in mandatory “C” disk, I installed it in another one. But I wonder, whether it would had impact.
    Do help with this.
    Thank you.


      yaar skype pe rabta karna main install karwa doon ga…id is same


    Thanks, I follow the steps and its working, your help is well appreciated, have a great day ma’am


    Thanks for the thorough tutorial! I am having an issue setting up multisite. I changed and added the appropriate lines in the wp-config.php file but when I login to the localhost site, there is no network setup option under tools. I’m using WordPress 4.1 Everything is running fine and I tried clearing the cache. Any suggestions?


    Hi Raelene,
    Thanks for this, everything went according to plan until I edited the wp-config.php for the network setup now I’m getting the following message:

    Notice: Constant MULTISITE already defined in C:\xampp\htdocs\wordpress\wp-config.php on line 84

    and there’s no “Network Admin” option.

    Thanks for your help


    Now when I go to edit/add posts I get a banner appear offering me “Distraction-Free Writing” which I can’t get rid of, clicking on the x or “Dismiss” has no effect, even trying to use the distraction-free writing doesn’t remove the banner! Any ideas?


    Thanks so much for this tutorial. Love that each step in very thorough it what is supposed to be done.



    I have a problem “Open your WordPress folder, find the wp-config-sample.php file and rename it wp-config.php. Open the file and scroll down until you see the following lines:”

    I have renamed the file and double click to open. but it asks ” How do u want to open this tipe of file “PHP”

    so i stuck here. please help me to slove this problem.
    Thank you.