PHP-Redis on php-7.2.9 image

I have a laravel project that i now have moved from predis to phpredis.

But i can’t install phpredis to the php-7.2.9 image.

I try installing with

yes '' | sudo -E pecl install -o -f redis
sudo -E docker-php-ext-enable redis

but i am getting the error

configuration option "php_ini" is not set to php.ini location
You should add "extension=redis.so" to php.ini

Even when i try define a php.ini file for it to define the extension it will throw me out of the build.

Anyone that can point me in the right direction?

Heya @Monza - after running the install command, it should be possible to run something like this to ensure the extension is loaded when PHP is run:

echo 'extension=redis.so' | sudo tee /usr/local/etc/php/conf.d/docker-php-redis.ini;

Would you mind giving that a shot and seeing if that helps?

Thanks for replying.

The problem is that it seems it “crashes” right after install with the message that it can’t find the php.ini. But the image don’t use a php.ini file.

The error i get is.

install ok: channel://pecl.php.net/redis-5.1.1

configuration option "php_ini" is not set to php.ini location

You should add "extension=redis.so" to php.ini

Error: Exited with code 141

Step failed

Error: runner failed (exited with 101)

Task failed

Error: task failed

I have tried
set the config path
sudo pear config-set php_ini /usr/local/etc/php/php.ini-development
but it doesn’t seem to do anything.
Have tried to copy the files to php.ini and point to that, but no luck.

I was able to fix this issue by running this

yes 'no' | sudo pecl install -f redis || true
sudo docker-php-ext-enable redis.so

The problem is that pecl returns an exit code 141 which is taken as an invalid status code from circleci.

I was able to bypass the problem by appending || true to the command, and make sure no error is thrown. If the redis ext. is not properly installed, the next line would fail anyway.