美文网首页
Docker pecl安装指定版本的php扩展

Docker pecl安装指定版本的php扩展

作者: 山哥的哥 | 来源:发表于2021-01-09 22:58 被阅读0次

一般情况下,直接用pecl install redis会安装最新版本的redis扩展,但由于php版本的不同,最新版的redis扩展不一定适合,所以我们需要安装指定版本的扩展。

打开一个php容器的终端

docker exec -it php56fpm /bin/bash

安装指定版本的扩展

pecl install https://pecl.php.net/get/redis-4.3.0.tgz

简易写法

pecl install redis-4.3.0

您需要什么扩展及版本对应的下载地址,可以去php官网查https://pecl.php.net

在Docker容器中启用pecl安装的扩展

docker-php-ext-enable redis

上面的命令可以不需要去手动修改php.ini而启用指定的扩展,更多PHP容器命令可以查看Docker php安装扩展步骤详解

检查已安装的扩展信息

php --ri redis

扩展信息输出如下:


redis

Redis Support => enabled
Redis Version => 4.3.0
Available serializers => php

Directive => Local Value => Master Value
redis.arrays.algorithm => no value => no value
redis.arrays.auth => no value => no value
redis.arrays.autorehash => 0 => 0
redis.arrays.connecttimeout => 0 => 0
redis.arrays.distributor => no value => no value
redis.arrays.functions => no value => no value
redis.arrays.hosts => no value => no value
redis.arrays.index => 0 => 0
redis.arrays.lazyconnect => 0 => 0
redis.arrays.names => no value => no value
redis.arrays.pconnect => 0 => 0
redis.arrays.previous => no value => no value
redis.arrays.readtimeout => 0 => 0
redis.arrays.retryinterval => 0 => 0
redis.arrays.consistent => 0 => 0
redis.clusters.auth => no value => no value
redis.clusters.persistent => 0 => 0
redis.clusters.read_timeout => 0 => 0
redis.clusters.seeds => no value => no value
redis.clusters.timeout => 0 => 0
redis.pconnect.pooling_enabled => 0 => 0
redis.pconnect.connection_limit => 0 => 0
redis.session.locking_enabled => 0 => 0
redis.session.lock_expire => 0 => 0
redis.session.lock_retries => 10 => 10
redis.session.lock_wait_time => 2000 => 2000

相关文章

网友评论

      本文标题:Docker pecl安装指定版本的php扩展

      本文链接:https://www.haomeiwen.com/subject/ygzlaktx.html