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:
- Install web server, database server, PHP, and Git
- Either install Drupal if starting from scratch, or clone the code, database, and user-generated files from your live site
- 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
Essential prerequisites
Set up Drupal on your local machine
If you want our recommendation, on the Drupalize.Me team, we all use DDEV as a local development environment. Learn how to install Drupal locally with DDEV in this tutorial:
Development environments
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.
Learn about the minimum requirements for running Drupal. If you need Drupal 7 specifics, see the Drupal 7 system requirements
Set up your environment for theming in Drupal:
Essential tools
Learn to use Docker for Drupal Development:
Note: DDEV uses Docker, so unless you want to get into the details of how to customize Docker containers, we recommend using DDEV as a local development environment for Drupal.
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.