It is always good practice to have testing environment installed locally where you can access it with out internet connection. It can be a real life saver if your internet connection slows down or is lost completely as you can continue to work on modifying your WordPress site in your test area and then update your live site later.
This tutorial will show you how to install WordPress locally. It may seem daunting at first, but as you shall soon see, it’s actually very easy and it will give you a controlled environment to work on themes or plugins.
XAMPP is a great free tool that can be installed easily on a Mac, PC or Linux. This open source package contains all the necessary tools that a WordPress install requires; Apache, MySQL, PHP and Perl. The following install was done on a Mac but installing on a PC or Linux machine are virtually identical. Let’s get started.
1. Download and install XAMPP https://www.apachefriends.org/download.html to the /Application/XAMPP
Then run the install wizard.
Then select your components. You will need both XAMPP Core and Developer Files for this install.
You can download the latest version of WordPress right from the bitnami site or download the latest version of WordPress from WordPress.org (https://wordpress.org/)
XAMPP is an Apache distribution that contain MySQl, PHP and Pearl
2. Drag the dmg file to your application folder
This installs by default into these locations:
On Windows: C:\xampp,
On Linux: /opt/lampp
On OS X: /Applications/XAMPP
3. Start XAMPP in the application folder
4. Click on ‘Manage Servers’ then ‘Start All’– this will change the red status lights from red to green once all the servers are running.
Apache default is port 80
MySQL started at port 3306
5. Click on ‘Welcome’ tab then click ‘Go to Applications’– this will take you to this page http://localhost/xampp/splash.php Click on your preferred language and you will see this page:
6. In the left column under Tools, click phpMyAdmin
Log in to the admin if asked to
7. Click ‘New’ on top left column then check ‘Create database’ and enter ‘wordpress’ then select utf8_general_ci
8. Click ‘Create’ button
9. Download the latest version of WordPress– https://wordpress.org/download/
10. Open the ‘Application Folder’ for XAMPP here c:\xampp\htdocs\
11. Create a new folder for your WordPress installation– (e.g. wordpresslocal) and copy all of your WordPress files to it.
13. From the folder, open wp-config-sample.php in a text editor.
14. Edit the connection details as follows:
// ** MySQL settings ** //
define(‘DB_NAME’, ‘wordpress’); // The name of the database
define(‘DB_USER’, ‘root’); // Your MySQL username
define(‘DB_PASSWORD’, ”); // …and password
define(‘DB_HOST’, ‘localhost’); // 99% chance you won’t need to change this
So the connection details should look like this:
15. Rename the wp-config-sample.php file to wp-config.php and hit ‘SAVE’
16. Install WordPress– Loading this URL into your web browser: http://localhost/wordpresslocal/wordpress/wp-admin/install.php
17. Fill out the form– and voila you have a local installation of WordPress for your testing pleasure.
*IMPORTANT NOTE: In order to update the WordPress core or add/update plugins, you will most likely get all kinds of errors when attempting to do so. These errors are from permission and ownership conflicts with the FTP server, your computer and WordPress. You can spend many hours chasing down all the conflicts or you can follow these easy steps that will show you how to by-pass FTP for your updates.
1) Access /wp-config.php
Open your /wp-config.php file from the WordPress root folder from your installation folder wordpress/wp-config.php
2) Add FS_METHOD direct.
FS_METHOD forces the filesystem method. Paste this line of code below all other lines of code in your /wp-config.php:
define(‘FS_METHOD’,’direct’);
3) Save the changes to the file and close it. When you attempt to upgrade to the most current WordPress version you should see this:
That is all there is to it. Just follow the above instruction and you will have a locally installed fully functioning WordPress website.