IgorAlves
IgorAlves

Reputation: 5540

How to enable php5-redis using cli?

I have a docker container where I see all php modules:

root@7b995118fc27:~# php -m
[PHP Modules]
Core
ctype
curl
date
dom
ereg
fileinfo
filter
ftp
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

As we can see there is no php5-redis in that list. When I try to install it I get a message saying it is already installed:

root@7b995118fc27:~# apt-get install php5-redis
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-redis is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

My php version is 5.6

root@7b995118fc27:~# php -v
PHP 5.6.31 (cli) (built: Sep 15 2017 01:12:36) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

So the only conclusion (if Im not wrong) is that the php5-redis is installed but not enabled.

This is what I have in the Dockerfile:

FROM php:5-apache


RUN a2enmod rewrite
RUN a2enmod expires
RUN service apache2 restart
RUN apachectl -M


RUN apt-get update
RUN apt-get install -y php5-redis
RUN apt-get install -y redis-server
RUN php -m


COPY src/ /var/www/html
EXPOSE 80

CMD ["redis-server"]

So, how can I enable php5-redis in this scenario?

Upvotes: 0

Views: 919

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146490

You would need to add below statement to enable the redis extension

RUN cp /etc/php5/mods-available/redis.ini /usr/local/etc/php/conf.d && ln -s /usr/lib/php5/20131226/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/redis.so

Upvotes: 1

Related Questions