如何在 DDEV 的 Web 容器中安装像 mcrypt 这样的 pecl 扩展?

问题描述 投票:0回答:1

在 PHP 7.2 及更高版本中,mcrypt 扩展不再可用,但我的项目依赖于它。我知道该项目不应该使用像 mcrypt 这样古老的东西,但我对此没有任何发言权。我知道 mcrypt 已从 PHP7.2+ 中删除,但仍在 pecl 中。 如何让这个项目在 7.2 及更高版本中支持 php-mcrypt?

php pear mcrypt pecl ddev
1个回答
4
投票
文档

此 .ddev/web-build/Dockerfile 将安装来自 pecl 的 mcrypt 扩展。它使用问题中链接中的技术为 DDEV_PHP_VERSION 中的 PHP 版本构建 php-mcrypt(由构建过程提供)。

如果您想安装不同的 pecl 扩展,您可能只需要更少的软件包,但想法是相同的。

RUN disable_xdebug RUN if [ ! -f /usr/bin/sed ]; then ln -sf /bin/sed /usr/bin/sed; fi RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confnew" --no-install-recommends --no-install-suggests build-essential make autoconf libc-dev pkg-config php-pear php${DDEV_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 php${DDEV_PHP_VERSION}-mcrypt is already installed in web container we can just copy its mcrypt.ini RUN cp /etc/php/${DDEV_PHP_VERSION}/mods-available/mcrypt.ini /etc/php/${DDEV_PHP_VERSION}/mods-available/ && phpenmod mcrypt

© www.soinside.com 2019 - 2024. All rights reserved.