Okay! So, you have decided to start your own WordPress site. Good for you. Next thing to consider is where you are going to host your site. Basically, there are three options: WordPress.com (not to be confused with WordPress.org); finding a webhost; and setting up your website locally, on your own PC. The last option, a local installation, is meant for testing purposes only. I do not suggest that you should host a public site on your local machine.
Regardless whether you will be hosting your blog with WordPress.com or a web hosting company, I do recommend that you start with a local installation.
Why? So that you can play around with WordPress without the rest of the world knowing that you are. Every time you change something within your production environment – your site on the web – this will be visible to your visitors immediately. It does not make a professional impression when during one visit to your site changes to the design keep occurring and are reverted again.
Even when you are familiar with WordPress, I still recommend a local installation. Suppose your site is up and running for sometime already and starting to attract visitors. You stumble into a fantastic theme or a great plugin. Are you going to activate those on your site right away? Probably not. May be the adjustments you need to make are a minor as rearranging some of the widgets. Nevertheless, you should always test new stuff before uploading it to your production site.
So, one way or the other, you will need a testing environment. That is why I do recommend a local installation. Do not be afraid, this is not going to be too geeky.
Prior to installing WordPress you need to set up a web server. That is what I am going to describe in this post – step-by-step so that you can follow along. You will need:
- Apache - for running the website
- PHP - for executing the PHP scripts
- MySQL - for storing all the data of your website
Adding phpMyAdmin to this list will make managing your MySQL databases a lot easier – otherwise you will have to do this from the command line. phpMyAdmin runs in your browser, just like a website.
All-in-One Web Servers
Fortunately, there is no need to download and install all those components of the web server separately. There are a couple of wonderful all-in one web server packages available, which are free to download and easy to install. Personally, I prefer XAMPP which is available for Windows, Mac and Linux.
Other popular XAMPP alternatives for Windows are EasyPHP and WampServer. Please note that in contrast to XAMPP and EasyPHP, the WampServer does not include phpMyAdmin, so you will have to add that one yourself when you prefer WampServer above XAMPP or EaysPHP.
Another option for Mac users is MAMP. Linux user can either install the Linux version of XAMPP or download the needed components from the repository of their Linux distribution. In the remaining part of this post, I will do an installation of XAMPP for Windows. Let’s get that local web server up and running.
Step 1 – Downloading XAMPP
To get your copy of XAMPP for Windows direct your browser to this page (clicking the link will open a new window or tab). Scroll down to XAMPP USB Lite. The current version is 1.7.7. Download either the 7-zip archive (42 MB) or the zip file (108 MB). The advantage of these two compressed packages above the exe-installer, is that removing XAMPP later is as simple as deleting the appropriate folder.
Step 2 – Installing XAMPP
When the download has finished, open the Windows Explorer, find the archive and extract it. The result is a folder named XAMPP. Move or copy this folder to a top-level directory like C:\ – or whatever letter your hard disk been given. For the sake of simplicity, I will continue using C:\ here. So, XAMPP should now be located at “C:\XAMPP”. When it is, you are done with the installation.
Step 3 – Starting XAMPP
Look in your XAMPP folder for the file “xampp-control.exe” and double clicking it to start XAMPP. The XAMPP Control Panel appears. Click the Start-buttons right next to “Apache” and “MySQL”. When “Running” in a green background appears as in the picture above, your local web server is up and running. Congratulations! You are now a webmaster.
Step 4 – Stopping XAMPP
Stopping XAMPP is as easy as starting it. In the XAMPP Control Panel, click the Stop-buttons next to “Apache” and “MySQL”. The Stop-buttons will change back into Start-buttons. That is it. By the way, clicking the XAMPP Control Panel icon in the Windows taskbar will minimize the panel in the Windows system tray.
Of course, there is a lot more to explain about Apache MySQL, PHP and phpMyAdmin. But for our purpose, running WordPress locally on our own PC, it just fine the way it is right now.
Step 5 – Testing XAMPP
To test our web server, we are going to create a small PHP script. Open a plain text editor like Windows Notepad – not a word processor as Word or Writer! – and enter the following in a new file:
<?php phpinfo(); ?>
Save the file as “info.php”. Make sure your text editor does not append .txt to the file. Usually, a simple solution to prevent this is putting the filename between double quotes while saving it: “info.php”.
Copy this file to the “htdocs” subfolder within the XAMPP folder. When you have followed the instructions above you have to move it to “C:\XAMPP\htdocs” – this is the same folder where we will be installing WordPress. Check that your web server is running.
Within the address bar of your browser, type the following url: “http://localhost/info.php” and hit the enter key. The script info.php that you have just created, contains the phpinfo() function which shows you all system information relevant to your PHP configuration. When everything is fine, the page within your browser should look something like this:
This page proves that your local web server is running just fine. Please note that XAMPP is not intended for production sites. For educational purposes and simplicity, several security measures have been omitted. This is not a problem for our purpose. You can read more on XAMPP security here.
Apache and MySQL as a Service
Just remember to start XAMPP every time you want to work with your local WordPress site and stop it afterwards.When you find all that starting and stopping of Apache and MySQL too cumbersome, you can check the Svc-checkboxes on the left in the XAMPP Control Panel – only the ones next to Apache and MySQL.
Next time you start Windows, Apache and MySQL will start as a Windows Service (Svc) and there is no need to continue starting and stopping your web server, since Windows will start both automatically. You can always revert this by opening the XAMPP control panel again and clearing the two Svc-checkboxes.
The next step is installing WordPress, which is simple compared to the installation of our web server – a mission you have just accomplished successfully.