How to install WordPress local testing environments
In this tutorial, we’re going to setup WordPress on your local computer (laptop or desktop) to help you develop better themes, plugins, and test WordPress outside a live web environment.
What you’ll need to install WordPress on your local computer
In order to accomplish this tutorial, you’ll need to download a couple of pieces of free software from their source websites:
The first piece of software of course is WordPress, which is the software we’re trying to get running on your local computer. The second, XAMPP is a self contained LAMP (Linux, Apache, MySQL, PHP) server with all the setup already completed and optimized.
Setting up XAMPP on your local computer
The installer for XAMPP is a simple process, just follow the steps as you would with any regular installer and wait for the installation process to complete.
Once done, your computer will have a fully functional web server installed and running. From this point, you’ll be able to run any LAMP web application on your local laptop.
Why XAMPP? Before I continue, there are alternatives to XAMPP including a Macintosh specific and Windows specific version of the software. I’m not sure if the others are any better or worse, but I prefer XAMPP and since it comes in Mac, Windows, and Linux versions it’s the one I’ll recommend.
Configuring your WordPress database
The next step is to setup a database for WordPress in XAMPP. To do this, you’ll need to open the XAMPP application and turn on the web servers. After turning on your web servers, you should be able to visit your local website environment at http://localhost/ and see the welcome page for the XAMMP server.
To use WordPress on your XAMMP server you’ll need to setup a database by following these simple steps:
- open http://localhost/ in a web browser;
- open the phpMyAdmin link to open your database manager;
- selected Databases from the navigation tabs;
- create a new database with an appropriate name (wordpress for example);
Now that you have a database for WordPress to populate, it’s time to install the software properly.
Installing WordPress on your local server
Installing WordPress on your local server is now as simple as it would be on any website server except it’s local.
- download WordPress from the official source;
- decompress the archive;
- move the resulting folder to your local htdocs folder;
- set the folder permissions so everybody can read / write;
- open your new WordPress website at http://localhost/wordpress/ and enjoy;
Since I’ve done this a number of times over the years, there are a few things that I like to keep in mind to help me make the process smoother.
Set your file permissions
Take the time to set your file permissions on the WordPress folder. It may not seem a big deal but without the ability to write files, WordPress will struggle to create the required wp-config.php, .htaccess files, directories, and plugin files you’ll need later.
Local database settings
When you’re setting up WordPress, you’ll need to remember your basic credentials:
- Database Name – wordpress
- Database User – root
- Database Password -
- Database Host – localhost
Remember, there is no password by default for connecting to your local database.
If you’re still looking for help setting up your own local hosting environment for WordPress, here are some great resources that I can recommend:
- Installing WordPress on Your Mac with MAMP (Codex)
- Installing WordPress (codex)
- How to Install WordPress on Windows
- Installing WordPress locally
Of course, installing WordPress locally created it’s own set of problems from how to migrate your database between a test environment and the live site, to how to debug WordPress, develop themes, and connect to your server. I’ll do my best to find you some new tutorials to help you solve some of those problems shortly.