Whether you are a seasoned WordPress developer or just getting started with WordPress, working in a local environment is usually a good idea. Here are some of the benefits of using localhost instead of a web server for developing purposes:
- Ability to work offline.
- Much faster file manipulation because you are not limited by your internet connection or your web hosting speed. Even if you are not yet using SSD disk which you should.
- More flexibility with server configuration because web hosting providers usually have more or fewer settings locked. This way you will know which configuration options you need and you will be more successful at choosing the right web hosting for your next project.
It is also a good idea to use the localhost for testing additional features on your existing online projects.
What do we need?
With a quick search for WordPress requirements we find out that our environment needs support for:
- MySQL or MariaDB
- HTTPS support
We could install all three separately, but there is a much simpler way by just installing XAMPP (cross platform, Apache, MariaDB, Pearl, PHP).
XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache Friends, consisting mainly of the Apache HTTP Server, MariaDB database, and interpreters for scripts written in the PHP and Perl programming languages.Source: https://en.wikipedia.org/wiki/XAMPP
XAMPP is cross-platform so you are good to go as long as you are a Windows, OS X or Linux user.
Download XAMPP from its official website and begin the installation process.
[1.] Run the installation wizard
Here you can choose which components you wish to install.
[2.] Choose installation folder
Choose you installation location. Remember to not install in Program files, as stated in the warning at the beginning of the installation process.
[3.] Firewall settings
At the end of the installation process you will encounter an alert from Windows Firewall. You should allow Apache HTTP Server to communicate with Private networks.
[4.] Launch XAMPP
Congratulations, you have successfully installed XAMPP on your computer. You are now ready to begin WordPress installation.
Installing WordPress using XAMPP
Installing WordPress is easy, just head over to their official download page and get the latest version.
[1.] Extract WordPress files
Upon downloading the files, you will notice that the package is zipped. Use your prefered tool for unziping and extract the files to XAMPP installation folder. (»C:/xampp/htdocs/« if you used the default destination in step 2 above).
[2.] Launch XAMPP Control Panel
You can now open up XAMPP Control panel and start PHP and MySQL services. Go to your preferred browser and type “localhost/wordpress” and WordPress installation wizzard should show up.
[3.] Before continuing the installation …
After choosing your preferred language, we are greeted with some instructions on what we need in order to install WordPress. Basicaly what we need is to
- create a database
- create a user (optional).
In order to create a database, you need to open the XAMPP control panel and click on the “Admin” button beside the MySQL service. This will open up the phpMyAdmin control panel, where we can manage our databases.
phpMyAdmin is a free and open-source administration tool for MySQL and MariaDB. As a portable web application written primarily in PHP, it has become one of the most popular MySQL administration tools, especially for web hosting services.Source: https://en.wikipedia.org/wiki/PhpMyAdmin
Create a database
Create a database by clicking on the “Databases” tab, type your preferred name and click create.
Create a user (optional)
Create a user by clicking on the “User accounts” tab. Under the user table we find a link to create new user account. Following that link brings us to the user creation page, where you need to:
- Choose a user name
- Choose a password
- Check all global privileges
[4.] Fill in the required information
Now that we have created our database and optionally a new user, we can fill in the required information:
- Database name
- Username and password . If you created a new user in previous step then use its credentials here. If you skipped that part, use “root” for username and leave the password empty
- Leave default for Database Host and Table Prefix
[5.] Create WordPress user
I you got the information right, the installation process continues and all that is left to do is:
- Choose a site title (you can change this later)
- Choose your username and password used for logging in your new WordPress site
- Type your email (you can also make up an email address)
After clicking the install button, we are greeted with the WordPress login page, which means we have successfully installed WordPress in our localhost environment. The only thing left now is to log in and start working on that project.