When I set out to create this blog I looked at a bunch of different blogging platforms and options. My heart really wanted to use a platform developed with Microsoft ASP.Net since I’ve been programming in .Net for years and figured I could easily build the site the way I want it and, most importantly, test the site out locally before deploying it to the internet for the world to see. I never really found the .Net option I was looking for and all roads seemed to keep pointing back to WordPress because of its widespread use and abundance of themes and plug-ins. The only unknown that I had was could I somehow setup WordPress on my Windows PC so I could configure and test the site before deploying it to the masses? A quick Google search took me to the XAMPP website and that’s where I found my answer. This is the relatively simple process I went through to get a local WordPress website in Windows up and running.
Step 1 – Download and Install XAMPP
In order to host a WordPress site locally on a PC there needs to be a web server running to process the requests. This is where XAMPP comes in and it is pretty easy to get setup. Head over to http://www.apachefriends.org and click on the “XAMPP for Windows” button to start downloading the application.
Once the application has finished downloading, double click on the file to begin the installation process. Once the installation process has started, you will get a dialog asking you to select the components that you want to install. You can uncheck any components that you won’t use (like I did) or if you are unsure just install everything.
Next up, the installer will ask what folder it should it should put all the files in. Your first instinct might be to put it in the “Program Files” folder, but it is recommended to stay away from there because of potential write permissions issues caused by UAC. Instead, stick with the default to have it install to the root of the C:\ drive as shown below.
After clicking next, the installer will pop-up and information screen regarding how Bitnami has installers for WordPress, Drupal, etc. I prefer to go to the source (WordPress in this case) to download installers vs downloading it from a secondary site like Bitnami. So, I unchecked the option and continued on with the installation.
Step 2 – Start-up XAMPP
Now that XAMPP is installed it is time to start it up. If it didn’t automatically launch for you, goto Start -> All Programs -> XAMPP -> XAMPP Control Panel to launch the application. Once the application is running you’ll need to start the Apache and MySQL services. Click the 2 start buttons next to the Apache and MySQL services as highlighted below.
You may receive a couple security alerts from the Windows Firelwall when starting the services up. Just click “Allow Access” on the security alerts to keep the firewall from blocking communications from Apache or MySQL. Note: If IIS (Internet Information Services) is running on your computer, you will have to disable the websites or change the port IIS is hosting on to be able to start up Apache on port 80.
Your local web server should now be up and running. Open up your web browser and type “http://localhost/xampp/” in the address bar and you should get a page similar to what is below.
Step 3 – Creating the Database
WordPress websites store their posts and other information in a MySQL database. So before installing WordPress, we’ll create the database. Go back to the XAMPP Control Panel and click on the “Admin” button for the MySQL service. This will open a new browser tab and navigate to the phpMyAdmin page. Click on the databases tab and you will see a page similar to below. Underneath “Create Database” there is an empty textbox where you can enter a new database name. You can enter anything you want for the database name, but I usually try to make my database name something close to my site name. Click “Create” to generate your database.
Step 4 – Download and Install WordPress
The last steps that are needed are to download the latest WordPress files from the WordPress website and install them locally. Open up a browser tab and go to http://wordpress.org/. Find the download location and click on the button to start downloading the latest version of WordPress. Once the download is complete, you will need to unzip the contents to the htdocs folder located inside your XAMPP install directory (For me this was C:\xampp\htdocs). The default name for the folder contained within the zip file is “WordPress”. I would recommend changing the name of this folder to your site name (this will be your website’s folder and files). Below is how my htdocs folder looked after unziping the WordPress files and changing the name of the unzipped folder.
Now there is just a small bit of configuration that needs done. Open the folder that you just created that contains the WordPress files and find the file named, “wp-config-sample.php”. Open this file with NotePad.exe. Find the section of the file that looks like the image below.
- Change the database name to match the name you entered when creating your database (where I have entered ‘LeftyCoder’).
- Change the DB_User line to be ‘root’.
- DB_PASSWORD should be an empty string (as shown above).
- DB_HOST should be ‘localhost’
Save the file when you completed making the changes. You will need to rename the file to make it “wp-config.php” instead of “wp-config-sample.php”).
The last step in the process is to actually install WordPress. Navigate to “http://localhost/#sitename#/ in your browser. #sitename# is what you named the folder that was copied into htdocs in a previous step. You should be taken to the WordPress Welcome page where you name your site, create your login and password and ultimately click the button to install WordPress.
After you click the “Install WordPress” button on the Welcome page, you will eventually be taken to the WordPress Dashboard.
This completes the WordPress install. You can now download themes, plugins and create posts just like you would if the site was hosted out on the internet.