How to Install WordPress on localhost using XAMPP

28 Jul 2011 By Articles 48 Comments
28
Jul

Setting up WordPress on localhost using XAMPP for the first time can be a daunting task. In this guide I will walk you through the steps needed to install WordPress in localhost using XAMPP.

How to Install WordPress on localhost using XAMPP

How to Install WordPress on localhost using XAMPP

Why Install WordPress on localhost?

I find that installing WordPress locally on localhost using XAMPP is good in turn that it lets you do a lot of testing prior to launching a live production site. You might have a lot of plugins that you require for your design and might not be sure if they are all compatible. You may also want to monitor the response time and download time of the site after each plugin you install.

This article is going to guide you through the steps required to setup and install WordPress in a testing or sandbox environment. The development environment we are going to be using for this article in Windows 7, however any Windows version will be fine. I will try and simplify the process by breaking the process down into a step by step process.

It would be a good idea to read through this complete article first, then come back to the start and work through the steps.

Step 1: Download and install the latest version of XAMPP

For this process to work, we are going to first have to download and install the latest version of XAMPP.

What is XAMPP?

Many people know from their own experience that it’s not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl.

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start.

Basically, XAMPP is the environment that allows us to install WordPress on a Windows computer.

Download the latest version of XAMPP for Windows

To download XAMPP you need to navigate to the Apache Friends website (http://www.apachefriends.org) and click the download link.

We want to install XAMPP for Windows

We want to install XAMPP for Windows

The easiest and least error free method of installing XAMPP is to download and install the XAMPP installer. XAMPP is available as three options.

  1. Installer – Probably the most comfortable way to install XAMPP.
  2. Zip – For purists: XAMPP as ordinary ZIP archive.
  3. 7zip – For purists with low bandwidth: XAMPP as 7zip archive.

Scroll down on the XAMPP download page and find the latest version of the XAMPP installer. Click to download and save to your computer.

Download the Installer version of XAMPP

Download the Installer version of XAMPP

Install XAMPP For Windows on localhost

Once the installer has downloaded double click the .exe file to begin installation. In my case I download xampp-win32-1.7.4-VC6-installer.exe.

The setup application will begin. First is to select the language you wish installed.

select the language you wish installed

select the language you wish installed

Next is to select the location of where you would like XAMPP installed. In my case and for ease of demonstration I want it installed on my C:\ drive so I will leave the preset location as it is.

Select location to install XAMPP

Select location to install XAMPP

After you have selected this step, the step step asked whether you want to install XAMPP as a Windows Service and if you want it added to the start menu and a desktop icon added. I selected “Yes” for the start menu item and desktop icon. I also what Apache and MySQL installed as a Windows Service.

Select the XAMPP Options

Select the XAMPP Options

Once you click the next button, XAMPP will begin installing onto your computer. Just before installation is complete you may be prompted to allow XAMPP through the Windows firewall.

You have successfully install XAMPP

You have successfully install XAMPP

Congratulations! You have successfully installed XAMPP For Windows. We now have development environment setup and installed. After the installation is complete, you will find XAMPP under Start | Programs | XAMPP. You can use the XAMPP Control Panel to start/stop all server and also install/uninstall services.

Now we need to make sure we have XAMPP running. Double click the XAMPP desktop icon or navigate to the art menu and start XAMPP from there. It must be running for us to install WordPress. Look at the below image for confirmation that the XAMPP server is running. The image displays the XAMPP control panel for start/stop Apache, MySQL, FilaZilla & Mercury or install these server as services.

The XAMMP control panel running on localhost

The XAMMP control panel running on localhost

Test XAMPP is running on localhost

Finally, we want to test to make sure that all went well and our XAMPP installation was successful. Open up your web browser and navigate to http://localhost. You should be automatically redirected to the XAMPP page. You should receive a message that states “Congratulations: You have successfully installed XAMPP on this system!“.

Check out the below image for clarification

XAMPP sucess page in http://localhost

XAMPP success page in http://localhost

Step 2: Download the latest version of WordPress

Now we need to download and install the latest version of WordPress. Navigate to the WordPress website (http://www.wordpress.org) and download the latest version. For this article I am going to be using WordPress version 3.2.1 which is currently the latest version.

After you download WordPress extract the contents to a location on your computer that is easily assessable. I extracted the folder to my desktop. The folder is named “WordPress”.

Download the latest version of WordPress

Download the latest version of WordPress

Now that we have the development environment corrected installed and working, we are going to want to create our first website using localhost.

Locate the folder or location where you extracted the “WordPress” folder. Copy this folder ( Ctrl->C).

Navigate to the root of your XAMMP installation c:\xampp\htdocs. This is the location where we create our website using localhost. The default XAMPP folder should contain a few folders and a bunch of system files. As pictured below. Leave these files as they are.

XAMPP default htdocs folder after installation

XAMPP default htdocs folder after installation

Paste the folder that you just copied from your desktop. (Ctrl->V ). For ease of simplicity I have decided to keep the folder from the WordPress download as the default “WordPress” folder name, however you can name the folder anything your like.

If you do decide to rename the folder just be aware of the name as you will need to access the website by that name when viewing the site.

Move our WordPress folder into c:xampphtdocs

Move our WordPress folder into c:\xampp\htdocs

Create the WordPress MySQL database

We are well and truly into the swing of things now. At this point it is time to create our blank MySQL database for WordPress to use. When we installed XAMPP it also comes complete with phpMyAdmin.

What is phpMyAdmin?

phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.

OK, getting back to creating our localhost MySQL database. Open up your web browser and navigate to http://localhost/phpmyadmin/

If you went the step further when installing XAMPP and set up the security you will end up at the phpMyAdmin login page as pictured below. If you did not set up security yet, you will gain immediate access into the phpMySQL area. Enter your login credentials to access this area.

phpMyAdmin localhost main login page

phpMyAdmin localhost main login page

The phpMyAdmin main page

The phpMyAdmin main page

Ok, now to create the database to hold the information and data for your WordPress site. Using the above picture as a guide half way down the page and under the header “MySQL localhost” you will see an area where you can “Create new database”. This is the area where we simple do that, create a new database. I am going to keep it simple and name my database “WordPress”. You can call the database anything you like. You just need to remember the database name as you will need it at a later stage.

Enter your database name and click the “Create” button. Your database will be created and you will be redirected to the new database page as pictured below.

MySQL database successfully created on localhost

MySQL database successfully created on localhost

At this point you have just created a blank database. Don’t be alarmed that there are no database tables as yet. This is normal. We are going to use the WordPress installation program and script to create these tables for us. You can now close down this page if you like or minimize it.

We are now moving down the home straight, It is time to run the WordPress installer script and install WordPress.

Installing WordPress

OK, now you have your “WordPress” folder sitting inside the website root C:\xampp\htdocs\wordpress.

Now we need to open up a web browser again and start the installation script. Navigate to http://localhost/wordpress

You should reach the default WordPress installation page. If you have not modified any of the files inside the folder you should see a screen stating that there is no WordPress config file. This is normal. The excact message states this:

There doesn’t seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn’t work for all server setups. The safest way is to manually create the file.

Go ahead and click the “Create a Configuration File” button to continue.

Read the contents of the next page and click the “Lets Go” button. This page just explains that you will need to input some data and information over the next few step to set up the configuration file correctly.

Now we need start inputting some information for our setup. Go ahead and complete these details.

WordPress Setup Configuration File on localhost

WordPress Setup Configuration File on localhost

These are the explanations for the various input fields

  • Database Name – This is the name that you gave the MySQL database when you created it earlier in PHPMyAdmin.
  • User Name – This is the User Name of the MySQL user to be able to read from the database.
  • Password – This is the User Name of the MySQL user to be able to read from the database.
  • Database Host – This is the location of the host that is hosting the MySQL database. In our case we simple leave it as default “localhost“.
  • Table Prefix – This field is convenient if you have multiple WordPress installations running on localhost. To keep it simple I am going to leave it as the default “wp_” however you can delete this or change it to anything you desire.

If all go wells and the script was able to communicate with MySQL you should be moved onto the next step that states that you have made it through this part of the installation. You will also see the button: “Run the install”. Go ahead and click this button to continue.

At this point, is is time to personalize your WordPress installation. You will now be presented with another forms that asks you for information and data relevant to the website you are setting up.

Personalize your WordPress installation

Personalize your WordPress installation

Here is an explanation of the various fields:

  • Site Title – This is the name of the website you want to create. In my case I am going to input “WPInsite”. You cane change this later on through the WordPress dashboard.
  • Username – This is the admin username you will use to access your WordPress dashboard. For security reasons I highly advise that you change this username to something that is relevant to you. Try not to use the default “admin” username.
  • Password – Enter a secure password that you can remember. This is the password you will use along with the Username to gain access into the localhost WordPress dashboard. There is a strength indicator that changes as you type your password. Use this as a guide as to how secure your password will be.
  • Your E-mail – Enter your email address here. This is the main email address WordPress will use to process email and so forth.
  • Allow my site to appear in search engines like Google and Technorati. – Place a check in this checkbox if you wish your website to be listed by Search Engines such as Google and Technorati. At this stage because we have installed WordPress on localhost as more of a sandbox account and development system we do not want anybody else accessing our site at this stage. When you move your website to a production server at a latter stage you should place a check in the checkbox as you want Search Engines and Robots to spider your website.

Fill out your details and click the “Install WordPress” button

You have successfully installation WordPress with XAMPP on localhost

Congratulations, you have just successfully installed WordPress with XAMPP on localhost. The screen you are now presented with informs you that your installation was successful. It also displays your username on the page. For security concerns your password it not displayed on the page.

There is one last button on this page. “Log In” Click this button to access you new WordPress dashboard. Use the username and password you entered earlier during installation.

Enter your WordPress credentials to access the Dashboard

Enter your WordPress credentials to access the Dashboard

Once you enter your login credentials you will be directed towards the main WordPress dashboard page. From this area you have the ability to totally modify your website details, themes, settings and content.

Main WordPress Admin Dashboard

Main WordPress Admin Dashboard

Navigate your way around the dashboard so that you are familiar with where certain pages are and how to achieve certain tasks.

Conclusion

This was a fairly lengthy article and there were quite a few steps involved in setting WordPress up on localhost using XAMPP.
To some up the task. You downloaded and installed XAMPP on locahost. You created your MySQL database to use with WordPress and finally you setup and installed WordPress.

Setting WordPress up in this fashion is a great way to test and create your websites. Developing and deploying WordPress websites in this fashion is great for a couple of reasons

  1. You do not have bandwidth lag as you are accessing the site and database from your server, not relying on a third party hosting provider on the other side of the world.
  2. If you make any visual mistakes and are modifying or designing your theme, this is a great way as you are the only person see the site. You visitors do not have access to this area so they will not see your half designed site.

I hope you enjoyed this article and it has given you a good understanding of how to Install WordPress on localhost using XAMPP. In a future article I will demonstrate how to export your sandbox or development site over to a live production server.

Be sure to check out our other great WordPress Articles and Plugins
Enjoy this article? If so, we would love to hear your thoughts in the comments below

 

Related Blog Posts

48 Responses to How to Install WordPress on localhost using XAMPP

  1. Hats off to whoever wrote this up and posetd it.

    Reply
  2. This worked out great for me. The only issue I had was going through the process of entering
    the database connection details. User Name and Password are set as well..Username and Password,the log in failed at that point. Maybe its a newer version on phpadmin. the simple solution for anyone who might be having the login problem there is to..

    1. Click Database in phpMyAdmin control panel.
    2. Click “Check Privileges” on the wordpress database, or what youve named the wp database
    3. Click Add a new User.
    4. User name : use text field. > create a user name to your liking.
    Host : local
    Password : then Re-type password
    5. Click generate and your done.

    Now if you go back to the database connection details and enter your username
    and password info it should allow you to continue the wordpress install.

    Im hoping im giving the best advice here because this worked for me..now if for some reason
    I’ve done something wrong non-knowingly someone please correct me. But other then
    that I hope this helped someone out. =D

    Thanks for your tutorial by the way..very easy to follow!

    Reply
    • Yes I found the same thing. Whoever wrote this was a Unix / Linux user and used root which means I think anyone or anyuser. However in Windows you really need to enter a username and password, I used the same as the blog I was going to create. Also I had too many directories and sub-directories, Just use the C:\xampp as instructed.

      After I did that bingo, it worked!! Thanks again to the author of this article. .

      Reply
  3. Brilliant article. It allowed me to pick my way to installing WordPress on a lampp server I installed earlier today on a Linux Ubuntu 11.10 virtual machine running on my Mac mini.

    As a relative newbie that’s really pushed my limits in so many ways, and following your instructions was so clear and easy even though I was “translating” from a Windows install. Many thanks.

    The buzz of seeing the default blog page appearing in my browser served from my own development server was tremendous. Thanks again

    Reply
  4. It is easy for a blank, new site. What about for an existing site which you want to download and replicate? You will get a Database Error message more often than not.

    Reply
  5. nice post, i just around to find nice tutorial about installing wp at local computer . And because of your article , i got installed at my local. Thanks bro

    Reply
  6. thanks for sharing! this post resulted to be really helpful and i am now using wp in my computer…. and it works!!

    Reply
  7. Great & simple to follow instructions for setting up WordPress as LocalHost with XAMPP.

    I’m relatively new to building WordPress Sites for clients and have in the past build in a ‘live environment’. By simply repeating this process using different folder names in \xampp\htdocs and creating separate databases in PHPMyAdmin, I have managed to setup multiple installs of WordPress locally, for all my current WordPress Websites…

    Now to figure out how to export/import the completed WordPress Site to the Live Domain!

    Thanks for this very helpful article :-)

    Reply
  8. never seen a detailed article like this !!!!
    so great. i just read it once and become a fan

    Reply
  9. guysssssss u r great..there is no one to teach like this……..u took time to write the article but it was just great……….thnks a lot ..srsly thnks alot..!!! all d best for future … <3 WPinsite <3

    hey Jason ..even thnks to u for telling the way to move forward :D

    Reply
  10. For any of you who had trouble installing because of an “error establishing a database connection” look under the privileges tab, you will see the database you created, under the host column you will see that it says “%” instead of localhost, click on edit privileges and change the host to “localhost”, save and try again, yea it sucked not having someone tell me this, something so small held me up for hours, just passing the wealth around.

    Reply
  11. i m hosting one of my site on xampp …. i have a bif query. i want to know if i shut down my pc then will my site will also be shut down till my pc is offff ……….. plzzzzzz rplyyyyyyy………

    Reply
    • If you have setup the DNS to point to your home computer then yes if you shut down your computer it will shut down your site.
      Usually XAMPPP is only used as a development environment. Once the site goes live most move the site to a hosting provider.

      Reply
      • Quote “Usually XAMPPP is only used as a development environment. Once the site goes live most move the site to a hosting provider.”

        But still if I publish my site using wordpress will it be accessible to visitors? am I required to let my PC be turned on 24/7?

        Reply
        • Hi Greg,

          You can host your site locally on a home server through XAMPP. You will need a static IP and really good security.
          Your computer must also be turned on 24/7 for the site to be viewable by others.

          That is why we move the sites to hosting providers after development as they look after all these issues.

          Reply
  12. Hi there!

    Thank you for sharing this, it is very helpful. I was wondering if you had ever written the follow-up article explaining how to move this site to a hosting company?

    Thanks again!
    Holly

    Reply
  13. Wow! Nice tutorial. Thanks for the info. :)

    Reply
  14. Wow this is a great tutorial!! Thanks for share this post. Ilove wordpress too..

    Reply
  15. its great!!!!! awesome…….

    Reply
  16. i really love this article, it helps me alot, cant wait to see more of this…..good job, Kudos to u.

    Reply
  17. Such a nice and detailed article about xampp server. I haven’t faced any problem to install xampp server to my pc.
    Great article..
    Thanks

    Reply
  18. wow! thanks for this.. it helped me alot!

    Reply
  19. timothy kyle

    Everything worked great with the install, but when I tried to log in I got this message,

    Warning: require_once(C:\xampp\htdocs\wordpress/admin.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-admin\admin.php on line 12

    Fatal error: require_once() [function.require]: Failed opening required ‘C:\xampp\htdocs\wordpress/admin.php’ (include_path=’.;C:\xampp\php\PEAR’) in C:\xampp\htdocs\wordpress\wp-admin\admin.php on line 12

    Can you tell me what I did wrong?

    Reply
  20. Thank You so much. really helpful. but i have a problem, when i viewing the website i build from another computer, http:/// , only text that appear. the image, design gone . why ? how to solve it ? plzzzzz ?

    Reply
    • You are very welcome.
      If you have the website setup on your local network you should only be viewing the site through the URL of “http://localhost” then the folder name.

      Normally we view the website on the site computer that it is hosted on “http://localhost”. Extra configuration may need to be set up if you have a home server and are trying to access the site through your home network.

      Reply
  21. really thankful for this! how about sample easiest steps on publishing the site from localhost to web? waiting for your response. thanks!

    Reply
    • Thanks for your feedback. I will look at writing a follow up article in the future on how to publish the development site to the live web.

      Reply
  22. Hi

    I got this message trying to log on to wordpress using Xampp:

    Warning: require_once(C:\xampp\htdocs\wordpress/admin.php): failed to open stream: No such file or directory in C:\xampp\htdocs\wordpress\wp-admin\admin.php on line 13

    Fatal error: require_once(): Failed opening required ‘C:\xampp\htdocs\wordpress/admin.php’ (include_path=’.;C:\xampp\php\PEAR’) in C:\xampp\htdocs\wordpress\wp-admin\admin.php on line 13

    Can you help me?

    Reply
  23. nice post keep it up it’s help me install wp on xampp. tnx admin :) :)

    Reply
  24. hey!

    Thanks for the really helpful and indepth article, Really eases problems from newbies like myself.

    Keep up the good work!

    Reply
  25. It’s a superb article bro! Hats off to you admin… :)

    Reply
  26. it is really awesome article and for me it was great tutorial

    Reply
  27. Awesome article, I’ve referenced it several times. The one issue I’m running into now is that I’m working on multiple sites and I can’t have 2 “wordpress” folders in my XAMPP folder. I tried renaming one of the folders newfolder (for the sake of this example) and then going to the localhost/newfolder. My site showed up there but all of the elements from my theme were completely gone. Any idea what could be causing this?

    Reply
    • Hi Ryan,

      Thanks for the feedback. You can most definitely have more than one folder in the XAMPP root. In the folder structure you should a folder called “htdocs”. This is where you place all your website folders or sites. You just need to make sure each folder has a different name, however each folder can have a WordPress site installed.

      When you installed XAMPP did all install properly without any errors?

      Reply
      • I think did a poor job explaining my issue in the first place. I am aware that I can have multiple wordpress sites in the XAMPP root folder and that I need to rename them to distinguish them from each other. The issue I’m having is that when I change the name of the folder from ‘wordpress’ to the new name (i.e. newwebsite) and then I go to http://localhost/newwebsite/ I can see the website is there but the CSS elements are completely gone and the admin is not available when I go to localhost/newwebsite/wp-admin/. And then when I change the folder name back to ‘wordpress’ and go to localhost/wordpress/ everything works perfectly.

        Also, I tried changing the folder name before installing wordpress after creating my database and then going to the domain http://localhost/newwebsite/ and I just got some kind of error page. Once I switched the folder name back to ‘wordpress’ and went to http://localhost/wordpress/ everything worked just like this tutorial said it would.

        Reply
        • It definitely sounds like something is not right. I would try moving your websites out of the XAMPP folders and uninstalling and reinstalling the latest version of XAMPP again.

          When installing just follow the prompts and leave the settings as default.

          Reply
  28. thanks

    Reply

Leave a Reply