How to setup a local copy of WordPress with XAMPP
A “local copy” means that WordPress is running right there on your very computer, and not on some remote hosting. Why would anyone need that? And why is it even discussed in this – supposedly – gaming blog? Well, as you might have noticed if you’re a frequent visitor to this blog, I have migrated to WordPress very recently. I am a gaming blogger, so I assume other bloggers could be considering migrating their blogs to WordPress as well and might find this post useful. Also, if I not write this down and then forget something, it would be a total pain in the ass to data-mine the Internets for the same solutions again. So here it goes.
Why would someone need a local copy of WordPress?
Simply put – for development. It’s much easier, faster and cheaper (if you have limited bandwidth plan) to tune WordPress on your own computer than on some remote host that you have to first buy and make sure it’s not broken all by itself. Of course, there are some problems with migrating a local WordPress to a production (or “live”) server, i.e. your hosting, but it’s totally worth it.
What is WordPress?
It’s a free blog engine that runs on PHP and is very versatile thanks to thousands of plugins written for it. Some say that WordPress is too cumbersome and need to many resources to run, well, that’s only true if you leave it be with no tweaking at all. All stuff needs tweaking from time to time, even your new car. There’s a local weekly newspaper’s website I’m hosting, and it’s running on WordPress just fine with all the amount of stuff they post each day.
What is XAMPP?
It’s a free open-source cross-platform web server solution stack package, as Wikipedia puts it. Simply put, it’s a package of things you need to run a website in general and WordPress in particular, that are made to be installed and run easily and out-of-the-box. XAMPP includes Apache HTTP server, MySQL database, PHP and a bunch of other stuff we don’t need for WordPress.
There are of course lots and lots of alternatives to XAMPP, such as WAMP or Denver for Windows, and MAMP for MacOSx. I chose XAMPP for this example because it works on both Windows and Mac, and I had bad experience with MAMP trial just before it.
First, go to XAMPP project website here, choose your OS, download the corresponding version and follow the instructions they give for installing it, it’s all pretty straight-forward, nothing to be afraid of. I personally use XAMPP for Mac OSx right now on my notebook, but they are not very different.
After you installed it, there should be a folder \xampp\htdocs at where you installed the program. It’s important that you know where it is.
Start the XAMPP’s services (if they aren’t already running, you need Apache, MySQL and FTP). When you run XAMPP, there should be a Getting Started pop-up, that says where you can access your websites and what’s your username and password for MySQL. You’ll need those too.
Download WordPress from this page. Unzip the archive in xampp\htdocs\wordpress folder, open up your browser and go to http://localhost/wordpress/.
It will then ask you to fill some information, including your username and password for MySQL. If you’re stuck and WordPress can’t find the DB, change default DB name from “wordpress” to “mysql”, that’s usually the one working.
At some point WordPress will offer you to create wp-config.php, just make a new file in a text editor (NOT MS WORD!), copy-paste from WordPress and save it as wp-config.php in your WordPress folder.
After all is set, WordPress will ask you to login with your new credentials, and there it is – you just installed your very own copy of WordPress.
I will write another post about how to fix several possible errors that could pop up with WordPress running on XAMPP.