phpredis with LZ4 support on an M1 Mac

Hi all,

Is there anyone here that has managed to get the phpredis extension working with LZ4 compression support on an M1 Mac?

I've tried installing php-ext-lz4 first (it seems to be installed ok, shows up on extensions list etc) but still nothing .

If I try and build it from source using the ./configure --enable-redis-lz4 flag it doesn't recognise that the lz4 extension is installed and I get the error "only system liblz4 is supported".

Last edited:
The PHP Redis extension does not have built-in support for LZ4 compression. The `--enable-redis-lz4` flag in the `./configure` command refers to using the system's liblz4 library instead of the bundled version.

If you have installed the php-ext-lz4 extension successfully and it shows up in the extensions list, it means that the LZ4 extension is installed and enabled for PHP. However, the PHP Redis extension itself does not have native support for LZ4 compression.

If you specifically require LZ4 compression support with Redis in PHP, you might need to consider alternative approaches, such as using a Redis client library that has built-in LZ4 compression support. One option is the Predis library, which is a flexible and feature-complete PHP client library for Redis. Predis supports various compression options, including LZ4, and it can be installed via Composer.

To use Predis with LZ4 compression, you would need to install the Predis library using Composer. Here's an example `composer.json` file:

"require": {
"predis/predis": "^1.1"

After defining the `composer.json` file, run the following command to install the dependencies:

composer install

Once installed, you can use Predis in your PHP code and configure it to enable LZ4 compression. Here's an example:

require 'vendor/autoload.php';

$options = [
'compress' => true, // Enable compression
'compression_library' => 'lz4', // Set compression library to LZ4
// Other Redis connection options...

$client = new Predis\Client($options);

// Use the $client object to interact with Redis, LZ4 compression will be applied automatically


Please note that this approach involves using Predis as an alternative Redis client library with LZ4 compression support. It's worth noting that Predis is a standalone client library and not an extension like the PHP Redis extension.