Home > Database > Redis > body text

How to install redis extension in docker php container

WBOY
Release: 2023-05-26 22:01:04
forward
2229 people have browsed it

1. Download the redis expansion package

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

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

2. Unzip the expansion package

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

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

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

3.1 View the container

docker ps -a
Copy after login

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        容器内的地址
Copy after login

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是否安装成功
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template