如何在DDEV-Local的Web容器中安装pecl扩展(如mcrypt)? [英] How can I install a pecl extension like mcrypt in DDEV-Local's web container?

查看:120
本文介绍了如何在DDEV-Local的Web容器中安装pecl扩展(如mcrypt)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP 7.2和更高版本中,不再提供mcrypt扩展,但是我的项目依赖于此.我知道该项目不应该使用像mcrypt这样古老的东西,但是我对此没有任何发言权.我知道mcrypt已已从PHP7.2 +删除,但是仍在 pecl 中.

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.

该项目在7.2及更高版本中支持php-mcrypt怎么办?

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

推荐答案

DDEV-Local支持自定义Dockerfile,因此您几乎可以将所需的任何内容添加到Web容器.

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

此.ddev/web-build/Dockerfile将安装来自pecl的mcrypt扩展.它使用问题链接中的技术为PHP_VERSION中的PHP版本构建php-mcrypt.

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.

如果您想安装其他pecl扩展名,则可能只需要少一些软件包,但是想法是相同的.

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


# You can copy this Dockerfile.example to Dockerfile to add configuration
# or packages or anything else to your webimage
ARG BASE_IMAGE=drud/ddev-webserver:v1.13.1
FROM $BASE_IMAGE

ENV PHP_VERSION=7.3
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends --no-install-suggests gcc make autoconf libc-dev pkg-config php-pear php${PHP_VERSION}-dev libmcrypt-dev
# The "echo" below just forces accepting the "automatic" configuration, the same as hitting <RETURN>
RUN echo | sudo pecl install mcrypt
# Because php7.1-mcrypt is already installed in web container we can just copy its mcrypt.ini
RUN cp /etc/php/7.1/mods-available/mcrypt.ini /etc/php/${PHP_VERSION}/mods-available/ && phpenmod mcrypt

这篇关于如何在DDEV-Local的Web容器中安装pecl扩展(如mcrypt)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆