我已经设置了php-fpm,redis,nginx和mysql。现在,我想使用php redis扩展,我得到Redis类未找到错误。
我的php docker文件
# php-fpm
FROM php:fpm-alpine
RUN docker-php-ext-install pdo_mysql
ARG INSTALL_PHPREDIS=false
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
# Install Php Redis Extension
pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
;fi
CMD ["php-fpm"]
EXPOSE 9000
我的docker-composer.yml
version: '2'
services:
php-fpm:
build:
context: ./php-fpm
volumes:
- ../src:/var/www
nginx:
build:
context: ./nginx
volumes:
- ../src:/var/www
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/sites/:/etc/nginx/sites-available
- ./nginx/conf.d/:/etc/nginx/conf.d
ports:
- "80:80"
- "443:443"
depends_on:
- php-fpm
database:
build:
context: ./database
environment:
- MYSQL_DATABASE=mydb
- MYSQL_USER=myuser
- MYSQL_PASSWORD=secret
- MYSQL_ROOT_PASSWORD=docker
cache:
build:
context: ./redis
ports:
- "6379:6379"
我想在我的php中使用redis扩展名。不知道我在想什么。
谢谢。