0

I enabled Php snappy module and edited env.php to use snappy compression with redis.

  'session' => 
  array (
    'save' => 'redis',
    'redis' => 
    array (
      'host' => '127.0.0.1',
      'port' => '6379',
      'password' => '',
      'timeout' => '2.5',
      'persistent_identifier' => '',
      'database' => '2',
      'compression_threshold' => '2048',
      'compression_library' => 'snappy',
      'log_level' => '1',
      'max_concurrency' => '6',
      'break_after_frontend' => '5',
      'break_after_adminhtml' => '30',
      'first_lifetime' => '600',
      'bot_first_lifetime' => '60',
      'bot_lifetime' => '7200',
      'disable_locking' => '0',
      'min_lifetime' => '60',
      'max_lifetime' => '2592000',
    ),
  ),
  'cache' => 
  array (
    'frontend' => 
    array (
      'default' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'database' => '0',
          'port' => '6379',
          'compression_library' => 'snappy',
        ),
      ),
      'page_cache' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'port' => '6379',
          'database' => '1',
          'compress_data' => '0',
          'compression_library' => 'snappy',
        ),
      ),
    ),
  ),

It's working when magento loading fine but when i run magento commands on ssh i am getting following error;

PHP Fatal error:  Uncaught Error: Call to undefined function snappy_uncompress() in /var/www/web/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php:1131
Stack trace:
#0 /var/www/web/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(381): Cm_Cache_Backend_Redis->_decodeData('sn:\x1F\x8B\xF2\xA0\x05\xE8a:1494...')
#1 /var/www/web/vendor/magento/zendframework1/library/Zend/Cache/Core.php(306): Cm_Cache_Backend_Redis->load('94b_INTERCEPTIO...', false)
#2 /var/www/web/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(39): Zend_Cache_Core->load('94b_INTERCEPTIO...')
#3 /var/www/web/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(65): Magento\Framework\Cache\Frontend\Adapter\Zend->load('interception')
#4 /var/www/web/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(65): Magento\Framework\Cache\Frontend\Decorator\Bare->load('interception')
#5 /v in /var/www/web/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php on line 1131

The are issue when decode the code i think. How can fix this?

  • I started writing an answer for your, but realized I can't actually give more than general advice without more detail. 1) How was snappy enabled? 2) Which ini files are being read by PHP, both for web requests and CLI? – mpw May 10 '18 at 16:59
  • i enabled it for cli and it's fixed thanks! – Efex May 11 '18 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.