How to set up WordPress offline

If you have a WordPress website or planning to build one, it may be beneficial if you run your website offline.

Rol John Torralba  — No Comments
How to set up WordPress offline

There are many reasons why you should set up WordPress offline. The most common reason is that we don’t have a web host to set it up, another, is the convenience of working on it offline.

From the first website I built with WordPress, until today, I always build them first offline before uploading it to the client’s web server.

The benefits of working on a WordPress website offline

I’ve built countless websites, and all of them started from an offline environment. From my experience, the best way to develop a WordPress website is by doing it offline as it comes with many benefits, and here’s why:

  1. It’s free. WordPress is free, but a web host is not, but that doesn’t mean you can no longer build your WordPress website without paying for a web host. Having a local server makes it possible for you to run WordPress offline, and the best part is that local servers are also free!
  2. Faster development. Working offline makes website development faster since you don’t have to wait for a server to load the files. That means, faster changes to your website’s content and your files, as it eliminates the need to upload the modified files, then downloading the updated website.
  3. Experimental changes. Another benefit, especially for web developers, is the freedom to experiment on their website. With an offline environment, you don’t need to worry about breaking your website while making changes, since it’s not live.
  4. Unlimited websites. Web hosts are limited in storage, and that’s true even for web hosts offering “unlimited storage.” The cheapest web hosting plans come with a limit. Exceeding the limit will either charge you or penalize your website, not to mention you are only allowed to host one website. Working offline, you can have all the WordPress website you need.
  5. Work privately. The benefit of privately working on your website is that no one would be able to see the work-in-progress. Why would you want that? A half-baked website is repulsive, we don’t want people looking at our unfinished work, and that includes your clients.

What is a local server and how to use it

In layman’s term, a local server is a location with a complete set of tools to run your website. Unlike static HTML sites — where you can open it directly in your browser — WordPress requires a local server to run.

Although there are many ways to run a local server on your computer, I only do the easiest one in this demo. That is installing a local server package.

Installing a local server package provides you the tools to run your WordPress website, so you don’t have to install them manually the hard way.

  1. XAMPP – Cross-platform web server solution stack package for Windows, Mac, and Linux.
  2. MAMP – Web server solution stack for Mac and Windows.
  3. WAMP – Web server solution stack for Windows.

XAMPP Control Panel Interface

If you’re on Windows, choose between XAMPP or WAMP there’s no wrong choice.

If you’re on Mac, choose MAMP as it’s more user-friendly than XAMPP.

Go ahead and download the chosen local server package. It’s best that you don’t change any settings in the installation process (unless if you know what you’re doing).

After you have installed the software, you need to start Apache and MySQL — the only services needed by WordPress for it to run.

When Apache and MySQL are running, locate the root document folder of your local server, this folder is where you should put all your WordPress websites.

The root document folder is the top-most directory in your server and where all the website files reside. Say, if you access a website with a domain (e.g., valiantweb.co) that is connected to your server, it serves you with the files in the root document folder.

Refer to the table below to locate your local server’s root document folder (assuming the default install settings):

XAMPP (windows) MAMP WAMP
c:\xampp\htdocs\ /Applications/MAMP/htdocs/ c:\wamp\www\

Put your website files inside the root folder as a subfolder. For example c:\xampp\htdocs\mywebsite\. By doing this, you can have as many websites on one local server.

Setting up WordPress in your local server

Now that you’re familiar with your local server and its root document folder proceed by downloading WordPress here. Save the ZIP file somewhere easily accessible.

The ZIP file contains a folder named “wordpress” and inside it, contains all the WordPress files.

Create a subfolder in the root directory, and copy all the files from the “wordpress” folder. Following the example above, you’ll have something like c:\xampp\htdocs\mywebsite\ where \mywebsite contains all the WordPress files.

Running WordPress

To run your WordPress website in your browser, type, and enter localhost/mywebsite. The directory localhost refers to your local server’s document root folder and /mywebsite is the subfolder of your website.

Running your WordPress website for the first time redirects you to the installation wizard where you need to add your database information. Don’t worry if this doesn’t sound familiar. I’ll guide you in the process.

WordPress Installation Wizard

Leave the page open for now and open a new window/tab.

Setting up your database

A database is where all your data is stored, think of it as a spreadsheet but way more sophisticated. Since WordPress is a content management system (CMS), it requires a database to store all your website’s content and all its data. The database is created separately and needs to connect with WordPress, without the connection, WordPress’ system can’t run, and neither is your website.

To create a database, head to localhost/phpmyadmin in your browser (localhost:8888/phpmyadmin for MAMP). In phpMyAdmin’s home, locate the “Database” tab and enter it.

phpMyAdmin Home Page

Once in the “Databases” page, create your database with a name of your choice, I usually prefix my database name with an identifier (e.g., demo_mywebsite) when working locally.

phpMyAdmin create database

Depending on your local server’s setup, it redirects you to the “privileges” page after you create the database. Check all the items on the page and continue.

phpMyAdmin Privileges

Having your database created, you can now submit your database information to WordPress’ installation wizard.

Since you’re working on a local server, you only have to worry about the Database Name, Username, and Password.

The database name is the name of the database you created, including the prefix; in our example, it is demo_mywebsite.

The username and password refer to the database user that owns the database, again, depending on your local server’s setup, the username may be different from this guide.

Here are the default database username and password for each local server:

XAMPP MAMP WAMP
username root root root
password root

Passwords for XAMPP and WAMP are both blank by default, so in the password field, leave it blank.

When you submitted the correct database information, it should continue on the next step of the installation.

WordPress database information

In this step, add your site title, admin username, password, and email, then hit “Install WordPress.”

WordPress Site Information

After setting up WordPress, it should install your WordPress website successfully.

Conclusion

In this article, you have learned to set up your WordPress website offline. It may be hard and complicated at first, but with every website you install offline, you’ll eventually get the hang of it.

Leave a Reply

Your email address will not be published. Required fields are marked *