I have set up php-fpm, redis, nginx and mysql. Now that I want to use php redis extension, I am getting Redis class not found error.
my php docker file
# 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
My 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"
I want to use redis extension in my php. Not sure what I am missing.
Thanks in advance.