How to install php-redis extension using the official PHP Docker image approach?

前端 未结 11 1041
Happy的楠姐
Happy的楠姐 2021-01-30 02:21

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

11条回答
  •  花落未央
    2021-01-30 02:54

    I'm using combination of PECL and PHP official docker extension script

    RUN pecl bundle -d /usr/src/php/ext redis \
    && rm /usr/src/php/ext/redis-*.tgz \
    && docker-php-ext-install redis
    

    For PHP7 you need to wait for official redis pecl release or use git:

    RUN apt-get update \
    && apt-get install git -y -q \
    && git clone -b php7 https://github.com/phpredis/phpredis.git /usr/src/php/ext/redis \
    && docker-php-ext-install redis
    

提交回复
热议问题