Site Building
Topic

Development Environments for Drupal 7, 8, 9, and 10

A development environment is any copy of your site that operates separately from the live site. Development environments allow you to make changes, try new modules, write new code, and test new ideas, on a copy of your site instead of the real thing, ensuring those changes happen in a sandbox where you’re not affecting anyone trying to use the live version of your application.

This is typically done by installing the server software required to run Drupal on your own computer and then creating a clone of your existing database and files. Or you might have a separate instance of the site setup on the existing infrastructure.

Here’s a basic recipe for setting up a new development environment:

  1. Install web server, database server, PHP, and Git
  2. Either install Drupal if starting from scratch, or clone the code, database, and user-generated files from your live site
  3. Clear the cache

Example tasks

  • Install Drupal on, or copy an existing site to, your computer to do development
  • Test modules and code without affecting the production site
  • Test server configuration changes on your localhost before deploying them to production

Confidence

There are dozens of ways to do this, and none is the only right way. The bare minimum requirement is that you have PHP, a web server, and a database running on the computer where you would like to install Drupal. Beyond that, it’s mostly personal preference.

Drupalize.Me resources

First, learn about best practices in Drupal development.

Categories
Drupal 7, 8, 9, and 10
More information

Today's Drupal developer needs more than just a text editor and FTP. Best practice Drupal development involves a suite of tools, processes, and more than one server environment.

This tutorial is directed toward an audience that is not familiar with best practices in Drupal Development and methods involving version control with Git, IDEs, local development environments, and deployment environments (i.e. stage, live). Here we're providing a high-level overview of these topics with links to dive deeper if you need more information.

In this tutorial, we'll cover:

  • Introduce Version Control Systems such as Git
  • Discuss how Git can be used to deploy to remote web servers
  • Review programming-centric text editors and Integrated Development Environments
  • Identify the need for a local development environment.
  • Explain shared deployment environments including production and stage.

What is a development site? These tutorials from the Drupal User Guide will help you understand what you need in a local development environment, in order to run Drupal locally on your machine.

More information

Overview of development sites with an example deployment workflow for site building.

More information

How to make a copy of a live site for development purposes.

Learn about the minimum requirements for running Drupal. If you need Drupal 7 specifics, see the Drupal 7 system requirements

More information

Overview of server requirements for installing and running the core software.

Learn to use Docker for Drupal Development:

Docker

Topic
Drupal 7, 8, 9, and 10
More information

For the Drupal developer, Docker is a way to provide a local development environment to run web server software.

Learn about why it’s important to clone an existing site with Drupal 8. Then do it, either via the Command Line Interface (CLI), or with Graphical User Interface (GUI) tools.

More information

Before you can get started synchronizing configuration between instances of your site, you'll need to create a new instance or "clone" of your Drupal site.

By the end of this tutorial, you should know:

  • Why it's necessary to clone your site if you want to manage configuration between environments
  • How to find your site's universally unique identifier (UUID)
  • What to consider when setting up a directory structure for your project
  • How to clone a Drupal site
More information

The configuration system in Drupal was designed to manage and sync configuration between instances of a Drupal site. So before configuration management can be useful, we must have another instance—or clone—of our Drupal site. In this lesson, you will learn:

  • Why cloning a Drupal site is necessary in order to manage configuration
  • How to clone a Drupal site using tools that have a graphical user interface (GUI)

If you prefer using web-based or GUI tools rather than command line tools such as Drush and Git, then this lesson is for you.

Learn how to use Git to keep the code on your development environment in sync with that on the live site.

More information

The Git version control system can help you keep track of changes in your codebase and make sure you don't unintentionally lose work.

Now that you’ve got a copy of your Drupal site on your local environment, using an IDE (Integrated Development Environment) such as PhpStorm can be highly useful, as it can autocomplete various language constructs, help you quickly locate inherited classes, alert you when a function is deprecated, provide debugging tools, and much more.

PhpStorm

Topic
Drupal 7, 8, 9, and 10
More information

The PhpStorm integrated development environment (IDE) contains dozens of useful features that make working with a Drupal codebase easier.

Set up your environment for theming in Drupal

More information

Making Drupal fast by default implies having caching layers and CSS and JavaScript aggregation utilities enabled out-of-the-box. As a theme developer this can be annoying, because you must clear these various caches in order to preview any changes. In addition, inspecting variables with debugging tools often produces PHP errors. We'll make some recommendations for PHP settings on your local environment that can prevent these errors from happening so often.

By the end of this tutorial, you should be able to:

  • Set up your local Drupal site for theme development
  • Prepare your local development environment for working on and debugging themes

Guides

Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources

  • Local Development Guide (Drupal.org)
    • The purpose of this guide is to assist you with creating and installing a new Drupal application on your local machine for the purpose of development. Installing Drupal using the following instructions will give you a starting point for a website that can be deployed to a production environment. The intended audience for this guide is a developer.
  • Local Dev Environments for Dummies
    • This MidCamp 2018 presentation by Jeff Geerling covers all the basics you need to know to be able to evaluate and determine what’s the best development setup for you, your team or your dev shop.

Choose any of these excellent community-built tools (all Docker-based) to get up-and-running with a local development environment. These free products are all cross-platform.

  • DDEV
    • DDEV is an open source tool that makes it simple to get local PHP development environments up and running in minutes. We use it internally at Drupalize.Me.
    • DDEV Docs (ddev.readthedocs.io)
    • See this repo for many example command snippets from the community: drud/ddev-contrib (github.com)
  • Lando
    • Uses Docker containers with sane defaults for Drupal and other open source web development. Includes configuration defaults for a number of popular open source frameworks, tech stacks, and hosting platform Pantheon.
  • Docksal
    • An all-purpose web-development environment based on Docker and Docker Compose.
  • Drupal VM (drupalvm.com)
    • Uses Ansible, and either a Vagrant VM or Docker containers to set up a Drupal-centered environment. Includes many convenient utilities for local development. A little harder to install but gives more flexibility and bundled features.
  • SimplyTest.me, and Try Drupal (Drupal.org)
    • Sometimes you just need to create a quick Drupal site to try out a new module or a proof of concept. SimplyTest.me is the fastest way we know of to do that. If you want something that doesn’t expire after 24 hours, try one of the hosting providers with free options from Drupal.org.

There are many others! Check out this panel at BADCamp 2019 with representatives from these and other tools talking local development tools for Drupal developers.