Home » » How to Install WordPress Locally for PC/Windows with XAMPP

How to Install WordPress Locally for PC/Windows with XAMPP

Setting up a local sever environment on your computer will save you a bunch of time if you regularly test or develop themes and plugins.

Not only will your local sites run much quicker than they would online, but you’ll also have a much safer testing environment away from a live site.
Having a localhost environment has dramatically improved my workflow and is even an important part of my WordPress working life. It’s such a waste of money using an online WordPress installation with a web host as a test environment!
This week we’ve looked at Mac solutions for local machines. Today we’re going to look at XAMPP for Windows, a free, popular and easy to install server environment application that’s open source.
XAMPP
Easily install XAMPP for Windows and run your own local server environment for WordPress.

What is XAMPP?

XAMPP stand for cross-platform, Apache, MySQL, PHP and Perl. It’s a simple and lightweight solution that allows you to create a local web server for testing purposes.
Since XAMPP is cross-platform, it also works on Mac and LInux, but today we’re going to look at setting up XAMPP on Windows 7.
WordPress isn’t a stand-alone application and needs server software to run. XAMPP provides the necessary environment needed to run WordPress on a local machine.

Installing XAMPP

Go to the Apache Friends website and download XAMPP.
Apache Friends Site
Download XAMPP from the Apache Friends website.
The XAMPP file is 125MB. Once downloaded, launch the installer.
You may receive warnings about installing the software on your computer. As you would when installing any software on Windows, use your best judgment.
The XAMPP setup wizard will guide you through the installation.
XAMPP installer
XAMPP setup wizard.
In the next window you will be asked to select which components of the software you would like to install and which one you don’t want. Some options, such as Apache and PHP are greyed out because they are essential to running the software.
It’s up to you which components you want and don’t want. Since I we want to run WordPress on this localhost, I’ll leave MySQL and phpMyAdmin checked and uncheck the remaining options.
XAMPP options
Choose the components of the software you want to install and untick the ones you don’t want.
Next, select the folder where you would like to install XAMPP. I’m going to create a new folder in C:\Program Files\XAMPP.
XAMPP select folder
Select the folder where you would like to install XAMPP.
In the next window you’ll be asked whether you would like to install Bitnami for XAMPP, which offers free tools for installing WordPress, Drupal and Joomla! on top of XAMPP. We’re going to install WordPress manually and without this promotional program, so untick “Learn more about Bitnami for XAMPP” and click “Next.”
XAMPP Bitnami
In this tutorial we’re going to set up WordPress manually, so untick this option.
After going through all those options, XAMPP is now ready to install.
XAMPP ready to install
Almost there…
Once installed, you’ll be asked whether you would like to start the Control Panel. Leave this option ticked and click “Finish.”
XAMPP Control Panel
Installation is quick and painless.
If you receive any security/firewall warnings during the installation process (such as the one below), make sure you check “Private networks, such as my home or work network” and click “Allow access.” This is very important. If you don’t allow access, XAMPP won’t work.
XAMPP firewall and security
Allow access for Apache and MySQL to ensure XAMPP can run.
If you left “Do you want to start the Control Panel now?” checked during installation, the Control Panel will automatically open. If not, go to the XAMPP folder on you computer and open “XAMPP Control Panel”.
XAMPP Control Panel
The XAMPP Control Panel.
Start up both Apache and MySQL. If you have installed XAMPP properly, both components should run fine without any errors, however, if there are any other applications on your computer using the same ports as these modules then you need to quit the conflicting applications using the same ports and restart XAMPP.
XAMPP running smoothly...
XAMPP running smoothly.
You can check if your new local server is installed by visiting http://localhost in your browser.
XAMPP localhost
Localhost is now installed and working!

Setting Up Your MySQL Database

Before we install WordPress, we need a database.
On your XAMPP Control Panel, click the “Admin” button in the MySQL section.
MySQL admin
Click “Admin” to set up MySQL.
A new browser window will automatically open with the phpMyAdmin interface.
XAMPP phpMyAdmin
Click “Admin” to set up MySQL or go to “localhost/phpmyadmin” in your browser.
Click on “Databases” near the top-left and you’ll be prompted to create a new database. I’ve called mine “WP”. When you’ve entered a name, click “Create” and close the window.
XAMPP MySQL database
Quickly and easily set up a new MySQL database for WordPress.

Download and Install WordPress

Download the latest version of WordPress.
In order to get WordPress working with XAMPP we need to unzip WordPress to the right folder. Go to the XAMPP folder on your computer and open the htdocs folder, i.e. C:/Program Files/XAMPP/htdocs.
XAMPP folder
Go to XAMPP/htdocs folder on your computer and unzip WordPress there.
Unzip WordPress into its own folder and rename it whatever you like. For consistency, I’m going to call this installation of WordPress “WP” to match the name of the database I just created.
Install WordPress
My installation of WordPress is called “WP.”
Open your WordPress folder, find the wp-config-sample.php file and rename it wp-config.php. Open the file and scroll down until you see the following lines:
wp-config database details
Update your wp-config.php file with your database details.
These lines of code define the login details for your database. Replace “database_name_here” with the name of your database, which in my case is “WP.”
Replace “username_here” with “root” and leave “password_here” blank.
Save the file and close it.
Now we can get on with installing WordPress.
Open your browser and go to http://localhost/wp/
You should see the welcome screen for the famous five minute WordPress installation process.
Famous five minute install
Set up WordPress using the famous five minute install process.
Enter your details and click “Install WordPress.”
Your WordPress installation is now complete!

Setting up WordPress Multisite

Having Multisite setup on a local machine provides a great way to test themes and plugins in a Multisite environment, but also makes it a quick and easy to have multiple sites running at once.
Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:
Activate Multisite
Activate Multisite installation mode.
Open XAMPP and ensure your Apache and MySQL servers are running.
Login to your localhost site in your browser and under “Tools” you will now have a new option, “Network Setup.”
Network setup
Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.
Enter a name for your network and your email address, then click “Install.”
WordPress will prompt you to edit your wp-config.php and .htaccess files.
Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:
Multsite wp-config
Edit your wp-config file to get Multisite up and running.
Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.
Your .htaccess file should look like this:
Edit .htaccess
Edit your .htaccess file to complete your Multisite installation.
Multisite should now be enabled and working on your WordPress site!
Multisite network
Your Multisite network should now be up and running!

Summing Up

XAMPP provides an easy way to run a local server environment on your Windows machine, allowing you to test and develop locally, rather than installing WordPress online. It will also save you a bunch of time since you won’t have to install and uninstall WordPress each time you test themes and plugins.
The great thing about XAMPP is that it’s free and also open source. You can set up as many installations of WordPress as you want and it’s just as easy to set up Multsite.
Next week I’ll look at how to set up WAMP, another popular option for setting up a local server environment for Windows.

https://premium.wpmudev.org/blog/how-to-install-wordpress-locally-for-pcwindows-with-xampp/
Thanks for reading How to Install WordPress Locally for PC/Windows with XAMPP

« Previous
« Prev Post
Next »
Next Post »

0 comments:

Post a Comment