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

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 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.

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.

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.

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

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?

Leave a Reply

Your email address will not be published. Required fields are marked *