Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 37 ยท Concepts and Installation

System Requirements and a Local Setup

Know what Drupal needs: PHP, a database, a web server and Composer, then choose a local environment such as DDEV, Lando, Herd or XAMPP and check it.

Before you install Drupal, your machine needs the same ingredients a real server needs. Getting the environment right is the number one source of beginner trouble: wrong PHP version, missing extension, database that refuses connections. This lesson lists the requirements and shows the main ways to build a local setup, so the next lesson's install goes smoothly.

Remember that exact version numbers move with each Drupal release. Always confirm them in the "System requirements" page of the Drupal documentation for the version you install.

The ingredients

A Drupal site needs four things:

  1. PHP, at the version the Drupal release requires, with common extensions: gd (images), pdo with your database driver, mbstring, xml, curl, opcache, json, zip, intl (recommended), and bcmath where the docs ask.
  2. A database: MySQL, MariaDB or PostgreSQL (SQLite works for small test sites).
  3. A web server: Apache or Nginx, pointing at the project's web directory, with URL rewriting.
  4. Composer, the PHP dependency manager. Modern Drupal is installed and updated with Composer.

Optional but common: Drush, a command-line tool for Drupal; Git; Node.js for theme build tools.

Choosing a local environment

Option How it works Good for
DDEV Docker containers configured per project, with Drupal presets Most Drupal teams; reproducible across machines
Lando Docker-based, recipe files Similar to DDEV
Laravel Herd Native PHP and Nginx on Windows/macOS Quick PHP sites without Docker
XAMPP / MAMP / Laragon Bundled Apache, PHP and MySQL Simple local servers
Docker Compose Your own container files Full control

If you are unsure, DDEV is the most popular choice for Drupal. It gives you PHP, a database, a web server and Drush inside containers, so nothing else on your computer matters. The only prerequisites are Docker and DDEV itself.

DDEV in four commands

With Docker and DDEV installed, a new project folder can be set up like this. This is a read-only example; run it in your terminal.

Terminal
mkdir my-drupal && cd my-drupal
ddev config --project-type=drupal --docroot=web --php-version=8.3
ddev start
ddev composer create-project drupal/recommended-project:^11

The --docroot=web option tells the web server to serve the web folder, which is where Drupal's public files live. Everything else (like vendor and your configuration) stays outside the web root, which is a security feature.

If you use a native stack such as Herd or XAMPP, create a database first, then place the project in the server's sites folder and point the server at web.

The database

Create an empty database and a user with full rights on it. For MySQL:

SQL
CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'a-strong-local-password';
GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'localhost';

You will give these credentials to the installer. Use utf8mb4 so emoji and all scripts work. With DDEV you can skip this step: it creates a database named db for you.

Checking your environment

A tiny checklist prevents many headaches:

  • php -v shows the expected version.
  • php -m lists the required extensions.
  • composer --version works.
  • The web server serves the web folder and rewrites clean URLs.
  • PHP's memory_limit is at least 256M for the installer.

The following stand-in imitates what Drupal's installer does at its "Requirements" step: it compares what you have with what is needed. The real installer does this inside PHP, and the result here is produced from data you type, not from a real machine.

JS Stand-in: requirements check

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Edit the machine object until the checker says it is ready.

File permissions

During installation Drupal writes to web/sites/default. It needs to create settings.php and a files directory. On a local machine the installer asks you to relax permissions on settings.php, then it locks them again afterwards. On a server, give the web user write access only to the files directory and temporary folders, never to code.

Version control from day one

Initialize Git before you install, and commit composer.json, composer.lock, your custom code and configuration. Do not commit vendor/, web/sites/default/files, or settings.local.php containing passwords. A .gitignore is included in the recommended project template.

A second stand-in: planning ports and URLs

Local environments use hostnames like my-drupal.ddev.site. This sketch generates a table of project URLs so you can see how one machine hosts several projects. It is illustrative only.

JS Stand-in: local project URL plan

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which folder should the web server's document root point to?

    Pointing at web keeps vendor code and configuration outside the public directory.
  2. 2. Why is DDEV popular for Drupal?

    DDEV configures containers per project so every developer has the same environment.
  3. 3. Which tool installs and updates modern Drupal projects?

    Composer manages Drupal core, modules, themes and libraries.
  4. 4. What should NOT be committed to Git?

    Uploaded files and credentials do not belong in the repository.

Summary

  • Drupal needs PHP with extensions, a database, a web server pointed at web, and Composer.
  • DDEV, Lando, Herd and XAMPP are common local environments; DDEV is the usual choice for teams.
  • Create a UTF-8 (utf8mb4) database or let DDEV do it.
  • Use Git from the start and keep secrets and uploads out of it.

Next: Installing Drupal with Composer