One thing that concerns me with some inexperienced web designers, is their penchant for developing or designing a site directly on a client’s web server–either they use a subdirectory on the server or start making changes to the live site itself. There are a number of reasons why developing directly on a client’s live server is a bad idea and I don’t think anyone needs me to point them out. Enter development environments and XAMPP.
XAMPP stands for Cross Platform Apache MySQL PHP Perl. It is, in essence, a development environment for web designers and developers that runs WordPress, Joomla, Drupal, and other similar applications on your local machine, thus eliminating the need to develop on a live server–and thus giving designers absolutely no excuse to develop directly on a client’s live server. Today, I’m going to lay out a step-by-step tutorial to install WordPress on XAMPP on your local machine. Please note that I use Windows 7 for this tutorial, but XAMPP also has an OSX and Linux version. What you use is entirely your choice, but some of the steps outlined in this tutorial may not apply to you.
Here’s the stuff I’m working with:
Windows 7 64bit
All of the software is current at the time this article was written.
Step One: Download XAMPP. You can get the latest version of XAMPP from the Apache Friends website, here. Download the Installer version. Once you’re done, run the EXE.
Depending on your computer’s settings, you may encounter the above warning message. Note that XAMPP is essentially telling you not to install it into your c:Program Files (x86) folder. Write that down, or commit to memory, then click OK. Follow the directions, let XAMPP install itself into your c: root folder to make things easier for yourself. Once the installation is finished, launch XAMPP’s control panel. If all went well, you should see something similar to this:
Note the green check marks next to my Apache, MySQL, and FileZilla installations. If this is your first time installing XAMPP, you may have the red X’s like the one next to my Tomcat installation instead. What you want to do is click on the red X’s and install at least Apache and MySQL. Once that is done, click on the “Start” buttons to fire up your Apache and MySQL services. If you’re running XAMPP behind a Windows Firewall, you may get a Firewall warning. Make sure you unblock Apache from the Firewall. If everything goes according to plan, your control panel should have Apache and MySQL highlighted in green, and the output at the bottom should indicate that your Apache and MySQL services are running.
Step Two: Time to test your XAMPP install to make sure it works and that your services are running. Open up your favorite web browser, and plug this into your address bar: http://localhost/ (localhost is your local machine). If it’s working correctly, XAMPP’s logo will show up and ask you what language you would prefer. After you select your language, you should see the following screen:
Congratulations, you just installed XAMPP and now have a working development environment. You can use this environment to run installations of WordPress, Joomla, Drupal, Magento, and many other applications. Whoo! That wasn’t too bad, was it? Now, let’s get to the real reason we were here; Installing and running WordPress off of your local machine.
Installing WordPress on XAMPP
Step One: Obviously, we would need to download WordPress first. At the time of writing this article, the latest WordPress version is 3.4.2, but later versions should be able to be run off of your local machine using XAMPP with no problems. So download WordPress.
Step Two: Next, we’ll need to set up a MySQL database for our WordPress installation before we go any further. The easiest way to do this in XAMPP is through phpMyAdmin. You can access this by going to http://localhost/ and clicking on phpMyAdmin under Tools. Alternately, you can go to http://localhost/phpmyadmin/. To create a new Database, click on the Database button as shown below.
Aside: You may have noticed the 127.0.0.1 is the same on your computer as it is on mine. This is because 127.0.0.1 is (in simple terms) your local machine or localhosts’s IP address. prior to running Apache and MySQL with XAMPP, if you tried to access 127.0.0.1 you would likely get an error. People used to (they still might, who knows) fool gullible users into trying to connect to 127.0.0.1 with the promise of some leprechaun gold, only for the user to find that no matter how many times they tried it, connecting to 127.0.0.1 presented them with an error.
Step Three: Under Create Database, give your new database a name. I often run more than one WordPress installation on localhost so I try to keep my naming conventions for WordPress installs something like “wordpress_box” or “wordpress_cashie” or “wordpress_buddy”, depending on what I’m playing around with at the time. Unless you know what you’re doing (and if you do, I wonder why you’re reading this tutorial) leave Collation as it is. Once you give your database a name, click on Create and enjoy this comforting message:
Step Four: Click on your newly minted WordPress database.
What we need to do now is create a WordPress user to avoid using the root user. On a live server, the root user is the one who has all privileges. This can get hairy if you do anything with the root user because you open yourself (or your client) up to a tangled web of security vulnerabilities. It is, in essence, bad practice. Now, if you’re only using this on your local machine, you don’t need to set up a user account and can install directly using the root user because there are, generally, fewer security concerns when it comes to your localhost. But then, just using the root user just because you can would be lazy. And we started this whole journey with the express intent of eliminating laziness and poor practices. So let’s make this WordPress user account. Click on the Privileges button at the top of the screen.
On the next screen, under “New”, click on “Add user”.
Fill in your login information, write down or note your username and password somewhere, and set the Host to either “Local” using the dropdown. Or type in localhost in the textfield. Then scroll down and make sure “
Finally, scroll down to the bottom of the window, and make sure you have all Resource Limits set to 0, and click on “Add user”. Now you should see something similar to this screen:
Okay, now you are all done with phpMyAdmin. Let’s go actually install WordPress now.
Step Five: Unpack your WordPress installation download that you got before. Copy the unpacked wordpress folder, navigate to XAMPP’s htdocs folder, and paste it inside the htdocs folder. If you installed XAMPP in its desired location, your htdocs folder should be located in c:xampphtdocs
Step Six: Go into the WordPress folder that you just copied into htdocs and locate the wp-config-sample.php file. Rename it to wp-config.php and open it in your favorite editor.
Step Seven: Inside your wp-config.php file, you should find places where you can fill in your information. So where it says ‘database_name_here’, fill in your database’s name. For this tutorial, my database was called ‘wordpress_box’, for ‘username_here’, I would use ‘awesome’. Password would be the password you assigned when you created the user for this WordPress installation. ‘localhost’, and the other fields can remain the same. Filling out the form, you should end up with something that looks similar to this (except with your password filled out):
Save wp-config.php and open up your browser again. Now, navigate to your WordPress installation by going here: http://localhost/wordpress/wp-admin/install.php
If everything works correctly, you should be welcomed by this screen:
Fill in your details and click on “Install WordPress” when you’re all done. It should be noted that the username and password you used for your database is not the same as what you will use for your WordPress installation. On a live server, never use the same username for your database and your WordPress administrative account. And always, make sure you have a strong password for both your database and your admin account.
WordPress should install without a hitch and afterward, you can log in to your new installation using the username and password you just created.
Congratulations, you just set up WordPress on XAMPP and now have a fully functioning installation to test your themes, plugins, and whatever else you might fancy. 🙂
I think the problems lies in Xampp directions in Step 2 because i didn’t get the same orange screen as you have asking for the language, so i may be missing something here.??. So, really not sure what to do. Should i just do a complete reinstall, close up Xampp, turn off the services, delete the folder and start again?
Before you attempt a complete uninstall and reinstall, try to check out where you’ve placed your WordPress files and folders. Remember, they should go into XAMPP’s htcdocs folder in order to work properly. Typically, I encounter this error when the WordPress files are placed in the wrong folder and usually, it isn’t something that would require you to reinstall. Try that first and see if it will help.
No, it is in the correct folder. If I look in my pphpMyAdmin on the web it tells me this….
1. The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Or alternately go to ‘Operations’ tab of any database to set it up there. ….and i am not sure what to do.
The other thing is says is….
2. You are connected as ‘root’ with no password, which corresponds to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user ‘root’…..
This one above is really stressing me because i am not sure if it is exposing my pc or what to do here.
What I do know is that i have not been able to enter a password or rather create one in mysql because i can’t seem to get in there to that orange screen.
3. After installing wordpress, I created an account and when i try to log in it tries to take me to wordpress.com rather than .org so does that mean i have installed the wrong wordpress by accident and what should I do? I feel so stupid.
Here’s what’s going on…
1. The solution to this might be as easy as logging out then logging back into phpMyAdmin. Considering you’ve probably already done that, the only solutions seem to point towards modifying config.inc.php. I’ve never had this problem so I can’t tell you from experience how to fix it, but these topics on StackOverflow has some suggestions:
2. It is unlikely that you are leaving your computer open to attacks. In fact working on your own PC is likely the only time you don’t necessarily need a password for root. You can, however set a password for your mySQL account by following these steps:
1. Go into phpMyAdmin
2. Click on the “Users” tab
3. Click on the “root” user
4. Find or click on “Edit Privileges”
5. Enter a password and hit OK or Save.
6. Restart your mySQL service in the XAMPP panel.
3. Sounds like you had ended up on wordpress.com somehow and may not have installed WordPress accurately on XAMPP. Here’s a video tutorial I recommend for making this process a little more visual: https://www.youtube.com/watch?v=L-M3d7RAYFw
Here’s really my problem at the moment after reinstalling…..
I still can’t seem to get the localhost/xampp/splash.php instead I keep geting localhost/dashboard and if I check my file “C:/xampp/htdocs/xampp/index.php” it says inside ”Something is wrong with the XAMPP installation :-(”
I have looked online and there are different answers but not many people seem to be able to get it fixed or the instructions are not clear.
This is the only thing from stopping me from progressing. Not sure what it is because i even uninstalled Skype and turned off Kaspersky to get Apache and Mysql going. But trying to open localhost on the browser always goes to the dashboard so i can never seem to get into that splash.php page that is in an orange colour.
Hope you have a turnaround on this for me 🙁 I am at a loss.
I really wish I could offer more support at the moment. Unfortunately, I haven’t used a PC and therefore, haven’t used XAMPP in over a year. I’m using MAMP on OSX now. They do have MAMP for PC, I believe, and you might have better mileage with that. However, I understand if you would really rather get XAMPP working than try to shift to something completely new.
Unfortunately, because I can’t offer much better advice at the moment, I can only suggest you try the Apache Friends forum, where they’re likely to be much more up-to-date and knowledgeable than I am about XAMPP and troubleshooting: https://community.apachefriends.org/f/viewforum.php?f=16&sid=7e27eeb1d58855f018c299289cf0fbe3
Sorry, Carina. I wish I could do more. 🙁
Sorry I best correct myself…..
Under Privileges the host is localhost and thn under type itsays on the first line ‘global’ but underneath that it says ‘wildcard: wordpress_xxxx.
while global says all privileges>then grant>yes, wildcard:wordpress_xxxx>all privileges>then grant>no
So this is confusing to me, does this mean that wildcard is an additional thing? I am not sure what this means.
wildcard typically means it accepts all settings under one main setting. It’s not really something you need to worry about with your original problem.
Damn, I realised wildcard was okay after seeing one of you image samples but have already gone and uninstalled and reinstalled in my frustration. Where my difficulty lies now is that I don’t get that screen to http://localhost/security/xamppsecurity.php where there is that yellow and orange panel to put my password in.,where I should be selecting the language, instead i get http://localhost/dashboard/ only.
It could be that things have changed within the XAMPP environment since I last visited this tutorial. Try pointing your browser to http://localhost/security/xamppsecurity.php and see if the page will load.
I installed Xampp and WordPress as well as your directions up until just before the WordPress welcome screen, but instead i am getting …Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12
Do you have any idea why this is happening?
I have just checked back into the phpmyadmin and as the localhost, the type says ….global wildcard: wordpress_xxxx, all privileges No, so should i edit privileges at all? And why is the type global wildcard?
i try installing following the guideline but i had a prompt saying i’ve already installed wordpress in xamp, so i need clear the database table to reinstall wordpress.
This can be due to a lot of different cases and it’s hard to tell which one is affecting you without more detail. But right off the bat, I can offer the following suggestions to help you troubleshoot this issue.
1. Have you deleted the old MySQL database that you were trying to install a new instance of WordPress onto? You can delete it by going into phpMyAdmin for your XAMPP installation. From there, follow the steps here again and see if that will work.
2. You may need to uninstall XAMPP and delete whatever MySQL databases you may have created and re-install XAMPP again.
3. If you’re encountering this error on a fresh installation of XAMPP and you’re positive that a MySQL database doesn’t already exist, try to find out what version of MySQL you’re running. WordPress is a little wonky on certain versions of MySQL. You may have to upgrade or downgrade your MySQL to smooth things out. I think it had issues with MySQL v. 4.1.7. Check here for upgrading instructions: http://superuser.com/questions/566013/how-can-i-upgrade-the-mysql-version-included-in-xampp
thanks you save my day, very helpful
You’re welcome, Harris! Thanks for dropping by and leaving a comment. 😀
I just wanted to say this is a really clear, excellent tutorial. My thanks.
Thanks, James. I’m glad this was helpful. 🙂
thank you soooooo much, i really can’t thank you enough for dis clearly illustrated steps! you’ve rocked my world!!!!!!!
No problem, nikky. I’m really glad it was helpful. 😀
excuse me sir. i’ve follow everything that is written in this guide but i always end up with “Error establishing a database connection”. i even use the same DB name and username but i still get the error. any suggestions? thanks in advance
Hi, Mr Irrelevant, usually when you get an “Error establishing a database connection”, it is in relation to how you set up the wp-config.php file for WordPress. Most of the time, it has to do with a space somewhere when you were first modifying the wp-config.php file. WordPress doesn’t work well with spaces in file names, database names, usernames, passwords, you name it. Make sure your spaces are represented as underscores if you really must use a space.
Unfortunately, to fix this, you have to delete all of the contents of the WordPress folder (note that you ONLY need to delete the WordPress contents and not XAMPP itself), unzip all of the contents back into the WordPress folder and edit the wp-config.php file again, this time making sure you have absolutely no spaces when you replace the fields.
You’re a master!!!! thank you!!!
No problem, crimson. 😀
Very very thank you!!
You’re welcome, vahid.