Why Install WordPress on localhost?
I find that installing WordPress locally on localhost using XAMPP is good in turn that it lets you do a lot of testing prior to launching a live production site. You might have a lot of plugins that you require for your design and might not be sure if they are all compatible. You may also want to monitor the response time and download time of the site after each plugin you install.
This article is going to guide you through the steps required to setup and install WordPress in a testing or sandbox environment. The development environment we are going to be using for this article in Windows 7, however any Windows version will be fine. I will try and simplify the process by breaking the process down into a step by step process.
It would be a good idea to read through this complete article first, then come back to the start and work through the steps.
Step 1: Download and install the latest version of XAMPP
For this process to work, we are going to first have to download and install the latest version of XAMPP.
What is XAMPP?
Many people know from their own experience that it’s not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl.
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start.
Basically, XAMPP is the environment that allows us to install WordPress on a Windows computer.
Download the latest version of XAMPP for Windows
The easiest and least error free method of installing XAMPP is to download and install the XAMPP installer. XAMPP is available as three options.
- Installer – Probably the most comfortable way to install XAMPP.
- Zip – For purists: XAMPP as ordinary ZIP archive.
- 7zip – For purists with low bandwidth: XAMPP as 7zip archive.
Scroll down on the XAMPP download page and find the latest version of the XAMPP installer. Click to download and save to your computer.
Install XAMPP For Windows on localhost
Once the installer has downloaded double click the .exe file to begin installation. In my case I download xampp-win32-1.7.4-VC6-installer.exe.
The setup application will begin. First is to select the language you wish installed.
Next is to select the location of where you would like XAMPP installed. In my case and for ease of demonstration I want it installed on my C:\ drive so I will leave the preset location as it is.
After you have selected this step, the step step asked whether you want to install XAMPP as a Windows Service and if you want it added to the start menu and a desktop icon added. I selected “Yes” for the start menu item and desktop icon. I also what Apache and MySQL installed as a Windows Service.
Once you click the next button, XAMPP will begin installing onto your computer. Just before installation is complete you may be prompted to allow XAMPP through the Windows firewall.
Congratulations! You have successfully installed XAMPP For Windows. We now have development environment setup and installed. After the installation is complete, you will find XAMPP under Start | Programs | XAMPP. You can use the XAMPP Control Panel to start/stop all server and also install/uninstall services.
Now we need to make sure we have XAMPP running. Double click the XAMPP desktop icon or navigate to the art menu and start XAMPP from there. It must be running for us to install WordPress. Look at the below image for confirmation that the XAMPP server is running. The image displays the XAMPP control panel for start/stop Apache, MySQL, FilaZilla & Mercury or install these server as services.
Test XAMPP is running on localhost
Finally, we want to test to make sure that all went well and our XAMPP installation was successful. Open up your web browser and navigate to http://localhost. You should be automatically redirected to the XAMPP page. You should receive a message that states “Congratulations: You have successfully installed XAMPP on this system!“.
Check out the below image for clarification
Step 2: Download the latest version of WordPress
Now we need to download and install the latest version of WordPress. Navigate to the WordPress website (http://www.wordpress.org) and download the latest version. For this article I am going to be using WordPress version 3.2.1 which is currently the latest version.
After you download WordPress extract the contents to a location on your computer that is easily assessable. I extracted the folder to my desktop. The folder is named “WordPress”.
Now that we have the development environment corrected installed and working, we are going to want to create our first website using localhost.
Locate the folder or location where you extracted the “WordPress” folder. Copy this folder ( Ctrl->C).
Navigate to the root of your XAMMP installation c:\xampp\htdocs. This is the location where we create our website using localhost. The default XAMPP folder should contain a few folders and a bunch of system files. As pictured below. Leave these files as they are.
Paste the folder that you just copied from your desktop. (Ctrl->V ). For ease of simplicity I have decided to keep the folder from the WordPress download as the default “WordPress” folder name, however you can name the folder anything your like.
If you do decide to rename the folder just be aware of the name as you will need to access the website by that name when viewing the site.
Create the WordPress MySQL database
We are well and truly into the swing of things now. At this point it is time to create our blank MySQL database for WordPress to use. When we installed XAMPP it also comes complete with phpMyAdmin.
What is phpMyAdmin?
phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.
OK, getting back to creating our localhost MySQL database. Open up your web browser and navigate to http://localhost/phpmyadmin/
If you went the step further when installing XAMPP and set up the security you will end up at the phpMyAdmin login page as pictured below. If you did not set up security yet, you will gain immediate access into the phpMySQL area. Enter your login credentials to access this area.
Ok, now to create the database to hold the information and data for your WordPress site. Using the above picture as a guide half way down the page and under the header “MySQL localhost” you will see an area where you can “Create new database”. This is the area where we simple do that, create a new database. I am going to keep it simple and name my database “WordPress”. You can call the database anything you like. You just need to remember the database name as you will need it at a later stage.
Enter your database name and click the “Create” button. Your database will be created and you will be redirected to the new database page as pictured below.
At this point you have just created a blank database. Don’t be alarmed that there are no database tables as yet. This is normal. We are going to use the WordPress installation program and script to create these tables for us. You can now close down this page if you like or minimize it.
We are now moving down the home straight, It is time to run the WordPress installer script and install WordPress.
OK, now you have your “WordPress” folder sitting inside the website root C:\xampp\htdocs\wordpress.
Now we need to open up a web browser again and start the installation script. Navigate to http://localhost/wordpress
You should reach the default WordPress installation page. If you have not modified any of the files inside the folder you should see a screen stating that there is no WordPress config file. This is normal. The excact message states this:
There doesn’t seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn’t work for all server setups. The safest way is to manually create the file.
Go ahead and click the “Create a Configuration File” button to continue.
Read the contents of the next page and click the “Lets Go” button. This page just explains that you will need to input some data and information over the next few step to set up the configuration file correctly.
Now we need start inputting some information for our setup. Go ahead and complete these details.
These are the explanations for the various input fields
- Database Name – This is the name that you gave the MySQL database when you created it earlier in PHPMyAdmin.
- User Name – This is the User Name of the MySQL user to be able to read from the database.
- Password – This is the User Name of the MySQL user to be able to read from the database.
- Database Host – This is the location of the host that is hosting the MySQL database. In our case we simple leave it as default “localhost“.
- Table Prefix – This field is convenient if you have multiple WordPress installations running on localhost. To keep it simple I am going to leave it as the default “wp_” however you can delete this or change it to anything you desire.
If all go wells and the script was able to communicate with MySQL you should be moved onto the next step that states that you have made it through this part of the installation. You will also see the button: “Run the install”. Go ahead and click this button to continue.
At this point, is is time to personalize your WordPress installation. You will now be presented with another forms that asks you for information and data relevant to the website you are setting up.
Here is an explanation of the various fields:
- Site Title – This is the name of the website you want to create. In my case I am going to input “WPInsite”. You cane change this later on through the WordPress dashboard.
- Username – This is the admin username you will use to access your WordPress dashboard. For security reasons I highly advise that you change this username to something that is relevant to you. Try not to use the default “admin” username.
- Password – Enter a secure password that you can remember. This is the password you will use along with the Username to gain access into the localhost WordPress dashboard. There is a strength indicator that changes as you type your password. Use this as a guide as to how secure your password will be.
- Your E-mail – Enter your email address here. This is the main email address WordPress will use to process email and so forth.
- Allow my site to appear in search engines like Google and Technorati. – Place a check in this checkbox if you wish your website to be listed by Search Engines such as Google and Technorati. At this stage because we have installed WordPress on localhost as more of a sandbox account and development system we do not want anybody else accessing our site at this stage. When you move your website to a production server at a latter stage you should place a check in the checkbox as you want Search Engines and Robots to spider your website.
Fill out your details and click the “Install WordPress” button
You have successfully installation WordPress with XAMPP on localhost
Congratulations, you have just successfully installed WordPress with XAMPP on localhost. The screen you are now presented with informs you that your installation was successful. It also displays your username on the page. For security concerns your password it not displayed on the page.
There is one last button on this page. “Log In” Click this button to access you new WordPress dashboard. Use the username and password you entered earlier during installation.
Once you enter your login credentials you will be directed towards the main WordPress dashboard page. From this area you have the ability to totally modify your website details, themes, settings and content.
Navigate your way around the dashboard so that you are familiar with where certain pages are and how to achieve certain tasks.
This was a fairly lengthy article and there were quite a few steps involved in setting WordPress up on localhost using XAMPP.
To some up the task. You downloaded and installed XAMPP on locahost. You created your MySQL database to use with WordPress and finally you setup and installed WordPress.
Setting WordPress up in this fashion is a great way to test and create your websites. Developing and deploying WordPress websites in this fashion is great for a couple of reasons
- You do not have bandwidth lag as you are accessing the site and database from your server, not relying on a third party hosting provider on the other side of the world.
- If you make any visual mistakes and are modifying or designing your theme, this is a great way as you are the only person see the site. You visitors do not have access to this area so they will not see your half designed site.
I hope you enjoyed this article and it has given you a good understanding of how to Install WordPress on localhost using XAMPP. In a future article I will demonstrate how to export your sandbox or development site over to a live production server.