如何使用官方PHP Docker映像方法安装php-redis扩展? [英] How to install php-redis extension using the official PHP Docker image approach?

查看:386
本文介绍了如何使用官方PHP Docker映像方法安装php-redis扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想基于php-redis 扩展名构建我的PHP-FPM映像。 _ / php / rel = noreferrer>官方PHP Docker镜像,例如,使用以下Dockerfile: php:5.6-fpm

I want to build my PHP-FPM image with php-redis extension based on the official PHP Docker image, for example, using this Dockerfile: php:5.6-fpm.

文档说我可以通过这种方式安装扩展,安装依赖项手动进行扩展:

The docs say that I can install extensions this way, installing dependencies for extensions manually:

FROM php:5.6-fpm
# Install modules (iconv, mcrypt and gd extensions)
RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
    && docker-php-ext-install iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd
CMD ["php-fpm"]

无Docker我使用 apt-get install php5-redis 安装了它。但是,如何使用上述方法安装它?

Without Docker I installed it with apt-get install php5-redis. But how can I install it using the approach above?

推荐答案

Redis不是 php-src中的扩展,因此您不能使用 docker-php-ext-install 。使用 PECL

Redis is not an extension that is included in "php-src", therefore you cannot use docker-php-ext-install. Use PECL:

RUN pecl install -o -f redis \
&&  rm -rf /tmp/pear \
&&  docker-php-ext-enable redis

这篇关于如何使用官方PHP Docker映像方法安装php-redis扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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