添加redis扩展

源码安装方式

ARG INSTALL_PHPREDIS=true
ARG PHPREDIS_VERSION=3.1.3
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
# Install Php Redis Extension
curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
&& tar xfz /tmp/redis.tar.gz \
&& rm -r /tmp/redis.tar.gz \
&& mkdir -p /usr/src/php/ext \
&& mv phpredis-${PHPREDIS_VERSION} /usr/src/php/ext/redis \
&& docker-php-ext-install redis \
&& rm -rf /usr/src/php \
;fi

PECL安装方式

ARG INSTALL_PHPREDIS=false
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
# Install Php Redis Extension
printf "\n" | pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
;fi

注:

源码安装方式的可以选择版本,PECL安装的记得注意php版本,因为默认会安装最新的版本

swoole扩展安装

#####################################
# Swoole EXTENSION FOR PHP 5
#####################################

ARG INSTALL_SWOOLE=false
ARG PHPSWOOLE_VERSION=1.9.23
RUN if [ ${INSTALL_SWOOLE} = true ]; then \
# Install Php Redis Extension
curl -L -o /tmp/swoole.tar https://pecl.php.net/get/swoole-${PHPSWOOLE_VERSION}.tar \
&& tar xvf /tmp/swoole.tar \
&& rm -r /tmp/swoole.tar \
&& mkdir -p /usr/src/php/ext \
&& mv swoole-${PHPSWOOLE_VERSION} /usr/src/php/ext/swoole \
&& docker-php-ext-install swoole \
&& rm -rf /usr/src/php \
;fi

相关文章:

  • 2022-03-02
  • 2021-08-16
  • 2021-11-05
  • 2021-05-21
  • 2022-12-23
  • 2021-05-18
  • 2021-11-30
猜你喜欢
  • 2022-01-03
  • 2022-01-13
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-01-22
相关资源
相似解决方案