Home >Database >Redis >How to install redis extension in docker php container

How to install redis extension in docker php container

WBOY
WBOYforward
2023-05-26 22:01:042262browse

1. Download the redis expansion package

redis扩展 下载地址     https://pecl.php.net/package/redis

docker php容器中怎么按装redis扩展

2. Unzip the expansion package

$ tar -zxvf redis-5.3.4.tgz  解压redis扩展包

docker php容器中怎么按装redis扩展

##3. Extension Copy the package to the PHP container

3.1 View the container

docker ps -a

docker php容器中怎么按装redis扩展##3.2 Copy the extension package to the PHP container

docker cp docker cp /docker/tool/redis-5.3.4 php:/usr/src/php/ext/redis

 # /docker/tool/redis-5.3.4      解压包的地址
 #  php:                         容器ID获取容器名称
 # /usr/src/php/ext/redis        容器内的地址

3.3 Enter PHP The container is installed with redis

docker exec -it php bash                   #进入容器

cd /usr/src/php/ext/redis                  # 查看扩展是否复制进入容器中

docker-php-ext-install redi                # 按转redis扩展

php --ri redis   或者    php -m            # 查看redis是否安装成功

docker php容器中怎么按装redis扩展

docker php容器中怎么按装redis扩展

docker php容器中怎么按装redis扩展

##

The above is the detailed content of How to install redis extension in docker php container. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete