Skip to content
Advertisement

How can I install a pecl extension like mcrypt in DDEV-Local’s web container?

In PHP 7.2 and higher the mcrypt extension is no longer available, but my project depends on it. I know that the project shouldn’t be using something as ancient as mcrypt, but I don’t have any say in this. I know that mcrypt was removed from PHP7.2+ but is still in pecl.

What can I do for this project to support php-mcrypt in 7.2 and higher?

Advertisement

Answer

DDEV-Local supports custom Dockerfiles, so you can add almost anything you want to the web container. See docs.

This .ddev/web-build/Dockerfile will install the mcrypt extension from pecl. It uses the techniques in the links in the question to build php-mcrypt for the PHP version in PHP_VERSION.

If you wanted to install a different pecl extension, you might need just a few less packages, but the idea is the same.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement