CMS Opencart. Настройка memcached на opencart 2.3
|
Столкнулся с необходимостью установить memcached на opencart 2.3.
Четкой инструкции не нашел, чат-операторы тоже помочь не могут, дают ссылку на форум опенкарта, где описано следующее
В файле system/config/default.php
значения
$_['cache_type'] = 'file'; // apc, file or mem
$_['cache_expire'] = 3600;
конфиги
// Cache
define('CACHE_DRIVER', 'mem'); // 'file', 'apc' or 'mem'
define('CACHE_HOSTNAME', 'localhost');
define('CACHE_PORT', '11211');
define('CACHE_PREFIX', 'oc_');
Пробовал делать по инструкции, но админка сайта начала ругаться :
2019-03-20 11:17:38 - PHP Notice: Use of undefined constant CACHE_PREFIX - assumed 'CACHE_PREFIX' in /home/agro2006/agro2006-shop.com.ua/www/system/library/cache/mem.php on line 17
2019-03-20 11:17:38 - PHP Warning: MemcachePool::get(): No servers added to memcache connection in /home/agro2006/agro2006-shop.com.ua/www/system/library/cache/mem.php on line 17
2019-03-20 11:17:38 - PHP Notice: Use of undefined constant CACHE_PREFIX - assumed 'CACHE_PREFIX' in /home/agro2006/agro2006-shop.com.ua/www/system/library/cache/mem.php on line 21
2019-03-20 11:17:38 - PHP Warning: MemcachePool::set(): No servers added to memcache connection in /home/agro2006/agro2006-shop.com.ua/www/system/library/cache/mem.php on line 21
|
|
|
|
Не получается.
По рекомендациям был заменен файл cache.php
Настройки admin/config.php и www/config.php
______
define('CACHE_DRIVER', 'memcached');
//define('CACHE_HOSTNAME', 'unix:///home/agro2006/.system/memcache/socket');
define('MEMCACHE_HOSTNAME', 'unix:///home/agro2006/.system/memcache/socket');
//define('CACHE_PORT', '0');
define('MEMCACHE_PORT', '0');
define('MEMCACHE_NAMESPACE', 'opencart_test');
define('CACHE_PREFIX', 'oc_');
____
Настройки default.php
____
// Cache
$_['cache_type'] = 'mem'; // apc, file or mem
$_['cache_expire'] = 3600;
|
|
Попробуйте такой вариант.
В /system/config/default.php:
$_['cache_type'] = 'memcached';
В /config.php и /admin/config.php:
define('CACHE_HOSTNAME', 'unix:///home/agro2006/.system/memcache/socket');
define('CACHE_PORT', '0');
define('CACHE_PREFIX', 'oc_');
|
|
Не проходит
Fatal error: Uncaught exception 'Exception' with message 'Error: Could not load cache adaptor memcached cache!' in /home/agro2006/agro2006-shop.com.ua/www/system/library/cache.php:11 Stack trace: #0 /home/agro2006/agro2006-shop.com.ua/www/system/framework.php(49): Cache->__construct('memcached', 3600) #1 /home/agro2006/agro2006-shop.com.ua/www/system/startup.php(105): require_once('/home/agro2006/...') #2 /home/agro2006/agro2006-shop.com.ua/www/index.php(19): start('catalog') #3 {main} thrown in /home/agro2006/agro2006-shop.com.ua/www/system/library/cache.php on line 11
|
|
Судя по всему, OpenCart 2.3 не поддерживает Memcached. Попробуйте использовать не Memcached, а Memcache (без «d» в конце).
Для этого в /system/config/default.php нужно вместо строки:
$_['cache_type'] = 'memcached';
прописать такую:
$_['cache_type'] = 'mem';
Данные подключения в /config.php и /admin/config.php такие же, как были указаны выше:
define('CACHE_HOSTNAME', 'unix:///home/agro2006/.system/memcache/socket');
define('CACHE_PORT', '0');
define('CACHE_PREFIX', 'oc_');
Проверил только что со своей стороны на чистом OC 2.3 — всё работает.
|
|
Спасибо большое! Работает
|
Тема закрита.