How to install php extensions on Trusty

php
redis
circle.yml

#1

I need to install PHP’s redis extension.
I’m on PHP 5.6 (PECL only supports 7+)
I’m running sudo apt-get install php5-redis. It works but then when I run php -m afterwards the redis module is not listed.

I tried this:

sudo touch /opt/circleci/php/5.6.18/etc/conf.d/redis.ini && sudo echo extension=/usr/lib/php5/20121212/redis.so > /opt/circleci/php/5.6.18/etc/conf.d/redis.ini

But it didn’t work…

ubuntu@box374:~$ php -v
PHP Warning:  PHP Startup: redis: Unable to initialize module
Module compiled with module API=20121212
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0

Warning: PHP Startup: redis: Unable to initialize module
Module compiled with module API=20121212
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0
PHP 5.6.18 (cli) (built: May 20 2016 10:30:48) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans

#2

Further research suggests that this issue is related to apt-get not finding a module version that corresponds to the PHP version being provided by .phpenv


#3

Sorry to bump this, but have you fixed it ? If so, how ?


#4