Install and Run WordPress in XAMPP Local Host

If you are planning to test WordPress before launching into your live FTP server, the best way is to test it first at the local host. For those that are completely unfamiliar with the term “local host,” it is a web server hosted right in your local computer (not a web server in a hosting company). This two-part article will show you how to test things out using XAMPP.

XAMPP is the most powerful local host for Windows XP that can execute PHP scripts and host the MySQL database, the vital programming components of WordPress. With XAMPP as a web server installed right in your Windows XP computer, you can launch and edit WordPress files just as you would in an actual hosting FTP web server.  

An XAMPP tutorial is beyond the scope of this article, though I encourage you to read my XAMPP tutorial here first for better understanding of this local Apache web server. It does provide you with the most important concepts on how to install and configure XAMPP in your Windows XP computer.  

Below are the primary reasons you should test your WordPress website at a local host. 

  • Speed up your on-site work. It is always faster to work at the local host than in the live FTP server. Things can be done faster, such as editing and saving files. If you work at the live FTP server directly, you will experience a bit of latency, so things will be a bit slower, which could affect your productivity.
  • Avoid catastrophic mistakes. For example, if you have a live site that already attracts a substantial amount of daily visitors, it would be distracting for them to see ongoing live on-site errors. So in order to provide the best customer experience, it is best to edit all WordPress files at the local host before uploading to the live FTP server.
  • Back up your work. Working with the local host will require you to download your FTP server files and then work on them. Thus, you still have a backup of your actual website files right in your web host. This is safer and in fact the recommended thing to do, as accidents do happen during editing that prevent your website from working properly, resulting in lost visitors. 

There are two possible scenarios where you can start editing WordPress at XAMP local host. In the first scenario, you still have not launched the site in your actual FTP server. Or you still have not installed WordPress in it. This means you will be starting the work entirely from scratch. 

In the second scenario, you already have a fully running WordPress website and you would like to make some improvements to it that require files to be downloaded locally for editing and then uploaded to reflect the changes. 

{mospagebreak title=Installation Starting From Scratch} 

Let us start with the first scenario, as it looks like we were going to do a lot of work. 

Step 1: Download WordPress to your desktop. You can get the latest version of WordPress (highly recommended for security) at the link. As of the time this article was written, the latest stable WordPress release is version 2.8. 

Step 2: Unzip the package in your desktop. Extract it as a folder. If you are using WinRar, you can extract it as a folder by right clicking the archive file and selecting “Extract to word press-2.8” See the screen shot below:

 

 

Step 3: Click the Word press-2.8 folder. Inside it you will find another folder simply named “Word press.” 

Step 4: Select the folder named “Word press” and copy and paste it to your XAMPP “htdocs” folder. 

Step 5: Inside the WordPress folder, find the file named “wp-config-sample.” This is a PHP file. Find the appropriate lines to edit according to your database user name and password, as I show and explain below. 

Assuming that my XAMPP local host database has the following parameters (remember to change the database configuration settings when you upload your WordPress files to the actual FTP server; you can get the database parameters from your web host):

Database name (recommended): wordpress

Username: root

Password: sneakyguy

MySQL hostname: localhost

 

Those lines will be edited as:

 

define(‘DB_NAME’, ‘wordpress’);

 

/** MySQL database username */

define(‘DB_USER’, ‘root’);

 

/** MySQL database password */

define(‘DB_PASSWORD’, ‘sneakyguy’);

 

/** MySQL hostname */

define(‘DB_HOST’, ‘localhost’);

 

After editing, save as “wp-config.php.” Save it at the same folder as “wp-config-sample.” 

{mospagebreak title=Creating the Database and Editing the Site}

Step 6: Now go to http://localhost/phpmyadmin/ . In “Create new database,” type “wordpress,”  and then click “Create.” It should give the message: “Database wordpress has been created.” 

Step 7: When database parameters are configured, you are now ready to install WordPress in XAMPP. To do this, enter the following URL in your browser:

 

http://localhost/wordpress/wp-admin/install.php

 

Step 8: WordPress will then ask you for a “Blog title” and your “email address.” Provide this information and click “Install word press.” Since we are installing WordPress locally, we do not need to check “Allow my blog to appear in search engines like Google and Technorati.” 

Step 9. After installation, WordPress will provide you a username and password. Please save a copy of it using notepad. 

Step 10. Success! You can now log in to your WordPress using: http://localhost/wordpress/wp-login.php

 

Alternatively you can view your newly installed WordPress blog at:

http://localhost/wordpress/

 

You can now start using different themes offered by WordPress. You can download freely several nice WordPress themes.   

Step 11. Perform on-site work in local host.

You can now start editing your WordPress-powered website in local host. Below are the things that can be done during the editing process: 

  • Change the themes or view of the WordPress site. 
  • Add posts and other useful content. 
  • Do search engine optimization on-site work.
  • Customize the navigation in such as way it will look like a professional  website instead of a web blog.
  • Add useful plug-ins that will support and improve the website’s functionality.
  • Change the header image and add a website logo.
  • Make the URLs shorter and SEO-friendly.

 

Step 12. Upload all the files to your FTP server.

When all is working well, it is time to prepare and upload all the files to your FTP server. I list the important steps below, but first, a warning. Since you have a fully running copy of WordPress in the XAMPP local host, it is your responsibility to back up the core WordPress files and data base, and run it in a test folder first before overwriting the old files. You can upload first to a test folder, for example www.domainname.com/test/, and then see if it is running properly as expected. After that, delete or overwrite the old files (do not forget to back up), and then delete the test folder. Remember to block the test folder first in robots.txt to prevent duplicate content issues with search engines.

Now, to prepare and upload those files, take the following steps:  

1: Upload WordPress to your FTP server (at the test folder first).

2: Configure the database settings similar to the way you did in the XAMPP database.

3: Install WordPress in the FTP server.

4: Export your local host XAMPP database to the actual web host MySQL data base.

5: Activate your themes and plug-ins. Your job is done. 

{mospagebreak title=Performing on-site work on an existing WordPress site} 

Follow the steps below when you need to do on-site work on your existing WordPress website at XAMPP localhost. 

  1. Download the entire WordPress MySQL database to your desktop. This can be done by exporting the entire WordPress MySQL database using phpMyadmin.
  2. Create a database in phpmyadmin using the exact name of the downloaded database.
  3. After creating the database, click “Import” and then select the downloaded database in your desktop. The importing process should successfully import all the tables and data from your MySQL database.
  4. Download all of the FTP files for WordPress to your XAMPP htdocs folder using a folder named “yourdomainname.” 
  5. Follow the steps under the “First Scenario” section starting at step 5 and going all the way down to Step 12. Note that the database name should match the one you configured recently in phpMyadmin.

A detailed tutorial on the second scenario will come up in the second part of this article. It will offer a complete step-by-step process for how to go on with this.

Conclusion 

In this article, we discussed how to install and run WordPress in XAMPP. Bear in mind that in order to create an exact replica of your website that runs in the XAMPP local host and in an actual web hosting FTP server, below are the important requirements: 

  • It should have the same core WordPress files installed.
  • It should be the same WordPress MySQL database being configured. 

Other things that are secondary in importance but still can influence the results include:

  • The PHP version used in XAMPP and the one used by your web hosting package.
  • MySQL version compatibility issues for both XAMPP and the one in live host.

2 thoughts on “Install and Run WordPress in XAMPP Local Host

[gp-comments width="770" linklove="off" ]