我尝试在基于php:7.2-apache
的Docker映像中安装mcrypt。因此,我使用文档中的RUN命令,并回答here,但我收到此错误:
error: /usr/src/php/ext/mcrypt does not exist
usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
/usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
if custom ./configure arguments are necessary, see docker-php-ext-configure
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt gd mbstring zip' returned a non-zero code: 1
我的停靠文件:
FROM php:7.2-apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt gd mbstring zip
# && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
# && docker-php-ext-install -j$(nproc) gd
COPY ./etc/000-default.conf /etc/apache2/sites-available/
EXPOSE 80
有没有人知道如何解决或如何获得所需的文件在请求的文件夹?
谢谢!
3条答案
按热度按时间ie3xauqp1#
mcrypt扩展从7.2起就不再随PHP源代码提供,但可以在through PECL中获得。要在docker中安装PECL扩展,请使用
pecl install
下载并编译它,然后使用docker-php-ext-enable
启用它:在
pecl install
之前,您可能需要安装/更新软件包libmcrypt-dev
7vhp5slm2#
基于MoiioM的回答,我使用PHP中的
7.2-stretch
Docker映像时,这个方法很有效kfgdxczn3#
要安装
mcrypt
扩展,您必须确保安装了必需的libmcrypt-dev
。尝试添加:
在你尝试安装php扩展之前.
先尝试运行:
然后