Skip to content
NewRedesigned blogFeedback
Jigar Karangiya

DDEV Docker: How to install additional PHP extensions in the DDEV project?

To Install additional PHP extensions you can easily add them to your project by defining them in .ddev/config.yaml file using the webimage_extra_packages tag.

DDEV Docker: How to install additional PHP extensions in the DDEV project?
Written by
JKJigar Karangiya
Published
Reading time
1 min read

Jigar Karangiya · · 1 min read

To Install additional PHP extensions you can easily add them to your project by defining them in .ddev/config.yaml file using the webimage_extra_packages tag.

DDEV (opens in new tab) is an open-source tool for launching local web development environments in minutes. It supports PHP, Node.js, and Python (experimental).

In this tutorial, I will install the php-imap extension as per my requirement in one of the projects.

I’m running a Magento 2.4.2-p1 setup with PHP version 7.4.

Defining Extension in config.yaml

You can specify your required PHP extension in your project’s config.yaml file’s webimage_extra_packages: [php7.4-imap] tag as like below.

yaml
name: myproject
type: magento2
docroot: pub
php_version: "7.4"
webserver_type: nginx-fpm
xdebug_enabled: false
additional_hostnames: [whipackaging]
additional_fqdns: []
database:
    type: mariadb
    version: "10.4"
use_dns_when_possible: true
composer_version: "2"
web_environment: []
webimage_extra_packages: [php7.4-imap]

Now you will be required to restart your project containers to install and activate your custom extension.

To restart the DDEV Project execute the below command inside your project directory.

RunTerminal
ddev restart

After a successful restart extension will be downloaded to your project container and will be loaded automatically.

You can verify installed PHP modules/extensions by the below command.

RunTerminal
ddev ssh
php -m

This will list all the installed extensions inside your project’s web container.

Figure 01

That’s it, You can install any PHP extensions for your specific PHP version requirement using this approach.

Let me know if you have any questions. Please share this tutorial if you found it very useful.

You may also like :

DDEV Docker: How to change the project PHP version?

DDEV Docker: Configure Cron in Magento 2

Magento 2: How to install and configure n98-magerun2 tool globally?

Keep reading
All posts

01 · 10 min · Shares Adobe Commerce Core

Adobe Commerce Agentic Capabilities, Q4 2026

Five agentic releases for Adobe Commerce: LLM product discovery, Brand Visibility, the Shopper MCP server, Brand Concierge, and Experience Workspace. What each one does, which editions get it, and when.

10 min

03 · 3 min · Shares Adobe Commerce Core

Conditions for Collections in Magento 2

Collections in Magento 2 (Now Adobe Commerce), are among the most powerful tools for retrieving and manipulating data directly from the database.

3 min

Newsletter

New Magento tutorials, straight to your inbox

Code examples, performance tips, and fixes for common Magento issues. No spam.

Subscribe