How To Install Wordpress on LocalHost... (with Pictures)

Download and Install WordPress

Download the latest version of WordPress.
In order to get WordPress working with XAMPP we need to unzip WordPress in the right folder. Go to the XAMPP folder on your computer and open the htdocs folder – C:/Program Files/XAMPP/htdocs.
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.





My installation of WordPress is called “WP.”
My installation of WordPress is called “WP.”

Setting Up Your MySQL Database

Before we install WordPress, we need a database.
In your XAMPP Control Panel, click the Admin button in the MySQL section.



Click “Admin” to set up MySQL.









                     Click “Admin” to set up MySQL.
A new browser window will automatically open with the phpMyAdmin interface.





Click “Admin” to set up MySQL or go to “localhost/phpmyadmin” in your browser.
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.



Quickly and easily set up a new MySQL database for WordPress.
Quickly and easily set up a new MySQL database for WordPress.

Open the WP folder where you saved WordPress, 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:



Update your wp-config.php file with your 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 actually installing WordPress.
Open your browser and go to http://localhost/wp/
You should see the translation screen that comes before the famous five minute WordPress installation process.



Choose the language you want to use WordPress in.
Choose the language you want to use WordPress in.
Once you’ve chosen your language, continue onto the next screen and enter you username and password details. Click Install WordPress.
Your WordPress installation is now complete!

Setting up WordPress Multisite

Having Multisite setup locally provides an efficient way to test themes and plugins in a Multisite environment, but also makes it a quick and easy to have multiple instances of Multisite set up.
Open your wp-config.php file again and add/edit the following lines to activate Multisite’s installation mode:
define('WP_DEBUG', false);
define('WP_ALLOW_MULTISITE', true);
/* That's all, stop editing! Happy blogging. */
view rawenable-multisite hosted with ❤ by GitHub
Open XAMPP and ensure Apache and MySQL are running.
Login to your localhost site in your browser and under Tools you will now have a new option, Network Setup.
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:
define('WP_DEBUG', false);
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy blogging. */
view rawsetting-up-multisite hosted with ❤ by GitHub
Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer. If you do not have a .htaccess file already, then create it in the same directory as your wp-config.php file. If you do have a .htaccess file, replace any existing lines with these new ones:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress
view rawmultisite-htaccess hosted with ❤ by GitHub
Multisite should now be installed.
You’ll need to log in again, and when you do you’ll see the WordPress dashboard from where you’ll be able to access individual sites in your network.

Wrapping 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 on a live site. 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 it’s free and open source. You can set up as many installations of WordPress as you want and it’s just as easy to get Multisite up and running.

Related Posts