red line

Developing WordPress Locally

This article assumes you know how to work a text editor and a terminal, and have at least a little bit of experience fiddling around with Linux and/or web servers.
soliddigital blog website set up

WordPress, PHP, and MySQL are what we might call “mature technologies”. They run on most servers, have high market share, and each has about 20 years of incremental refinement and improvements behind it. Naturally, there are many ways to run them locally for development. If you’re new to WordPress or programming on the Internet in general, it could feel like choice overload. Allow us to walk you through a few of the more popular options of local WordPress development tools so you can go back to arguing spaces versus tabs.

Requirements

This article assumes you know how to work a text editor and a terminal, and have at least a little bit of experience fiddling around with Linux and/or web servers.

Contenders

  • Vagrant: Probably the purest form of running a virtual server on your computer. Vagrant’s default providers are VirtualBox, Hyper-V, or Docker. Alternative providers can be set up as well. Functionally exists as a set of commands for configuring, running, and managing your server from the terminal.
  • Docker: Acts like a virtual server, but is actually a container full of whatever processes and software are needed to run your server OS and stack, sharing your laptop’s kernel.
  • Local: A sleek application intended to streamline the process of running WordPress locally. Handles most everything automagically, and minimizes the amount of system administration required by the user. Backended by Docker.
  • XAMPP (/jɝːmpp/): Installs your stack directly on your computer, no virtual servers or containers involved. Includes Perl as a bonus.
  • WAMP: Like XAMPP but for Windows and less configurable.

Completely scientific and objective comparison(s):

Ease of use: Local

You’re probably wondering what’s the easiest to set up? Local wins this all day every day, for starters because it has slick modern UI that works well, and it just works out of the box.

If you have some sysadmin chops, Vagrant isn’t all that difficult. It’s basically like setting up a server. If that’s not you, there are plenty of images and tutorials out there to simplify the path to running WordPress on Vagrant.

If you’re new to it, Docker’s containerization and handling of data persistence can inspire some existential questions as you learn to work with it. Once you get the hang of that, it’s basically like managing multiple Vagrant instances, but because Docker uses containers and not virtual machines, it’s faster and less resource intensive than Vagrant.

XAMPP or WAMP could be a strong competitor here if your dev machine is used only for developing in this particular stack. but I’ve run into weird configuration issues attempting to set it up on a general use machine, so I’ll put it in as the backmarker.

Performance: XAMPP/Docker/Local

The standout in this filed is Vagrant, since it tends to be slow and resource intensive due to the nature of running a virtual machine inside your host machine. Docker and Local have always run faster than Vagrant in my experience, since they both run containers via virtualization without hypervisor or virtual machines.

Customization: Vagrant

Vagrant is the most configurable option, and easily offers the most direct control over what your server is doing. If there’s anything about your project that’s unique or deviates from the basic LAMP stack, you can probably make it work (given a long enough timeline) in Vagrant.

That’s not to say it’s impossible with the others, but let’s say for instance (random example here) you need to make Wordpress talk to an Elasticsearch service that’s running on the same server:

  • Docker: There’s probably a way to run your searches, but composing your images could be A Task,
  • XAMPP: You might be able to run that on your local machine. Configuration portability could be a concern though.
  • Local: Haha, nope!
  • Vagrant: Just set up an Ubuntu virtual machine and configure it to include Elasticsearch. You can ssh onto the virtual machine and issue commands to install manually or use a provisioner like Ansible.

Portability: Docker/Vagrant

Where is your site being deployed? Are you the only person working on it?

My grandpa always said, “make your dev environment look as much like production as possible”. If you are part of a team working on a Wordpress project, you need a way of making your site’s configuration portable. Doing so will simplify deployment, as well as make it easy for everyone to run on their workstations.

This is handled beautifully by Docker and Vagrant, which both include ways of downloading (essentially) configured servers in the form of images, and provisioning them with whatever’s needed to get your site running.

Local does that too, except it focuses on just being really good at offering one particular configuration. XAMPP is my least favorite solution in this regard, unless you work on a team where everybody runs Ubuntu Server and VIM on their laptops.

Unpopular opinion/moral of the story

Use the simplest setup you can get away with. If you are just building a new theme for your Animorphs website, use Local. Are you trying to incorporate some Python deep learning thing into WordPress? Vagrant is probably your guy. Consider this a long-winded way of saying run WordPress whichever way is most consistent and trouble-free for yourself and your team.

Related resources
Authentication
code to dismiss alerts in Elementor