Skip to content

Instantly share code, notes, and snippets.

@Shahrozmunir
Last active December 5, 2024 18:20
Show Gist options
  • Save Shahrozmunir/3bbe43cd1fc6a048de8141a8d4c9fc2e to your computer and use it in GitHub Desktop.
Save Shahrozmunir/3bbe43cd1fc6a048de8141a8d4c9fc2e to your computer and use it in GitHub Desktop.
Example how to use ddev for drupal and wordpress on local environment

Setting Up DDEV for Drupal and WordPress


1. Install DDEV

Install Docker Desktop

Install DDEV

  • Download DDEV from the official site.
  • Install it using the package manager for your OS:
    • macOS:
      brew install ddev
    • Windows:
      Use the provided installer or Chocolatey:
      choco install ddev
    • Linux:
      Follow the Linux installation guide.

Verify Installation

  • Open a terminal and run:
    ddev version

2. Setup Project Directory

  1. Create a directory for your Drupal or WordPress project:
    mkdir ~/projects/my-drupal-site
    mkdir ~/projects/my-wordpress-site
  2. Navigate into the directory:
    cd ~/projects/my-drupal-site

3. Initialize DDEV

  1. Run the configuration command:
    ddev config
  2. Follow the prompts:
    • Project Name: (Optional, defaults to folder name)
    • Docroot Location:
      • For Drupal: Usually /web.
      • For WordPress: /.
    • Project Type:
      • Select drupal9, drupal10, or wordpress.
  3. Confirm your configuration. DDEV will create a .ddev folder with configuration files.

4. Download Project Code

  • If you don't have an existing codebase:

    • Drupal:
      ddev composer create drupal/recommended-project
    • WordPress:
      ddev wp core download
  • If you have an existing codebase, place the code in the directory and adjust the configuration if necessary.


5. Start the DDEV Environment

  1. Start the DDEV services:
    ddev start
  2. Access your site:
    • DDEV will provide a URL like http://my-drupal-site.ddev.site.

6. Database Access

  • DDEV provides built-in database services.
  • Login credentials are available by running:
    ddev describe

7. Additional Setup for Drupal

  1. Install Drupal using the URL provided by DDEV.
  2. For custom configurations, edit settings.php:
    • Add DDEV's database credentials (provided by ddev describe).

8. Additional Setup for WordPress

  1. Run the WordPress installation script:
    ddev wp core install --url="http://my-wordpress-site.ddev.site" \
    --title="My WordPress Site" \
    --admin_user="admin" \
    --admin_password="password" \
    --admin_email="[email protected]"

9. Manage and Stop DDEV

  • Stop the environment when not in use:
    ddev stop
  • Remove the environment:
    ddev delete

10. Useful Commands

Check Status

ddev status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment