After I changed https://www.cheapglasses.net to https://www.glassescanada.com, I got the following error message:
Warning: substr() expects parameter 1 to be string, object given in /vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php on line 1248
The glasses shop is based on Magento 2.4.3:
Varnish Caching
Version: 4-latest
Backend Host: localhost
Main Port: 32134
Admin Port: 32635
Agent Port: 49792
Web server
Apache
Database client version: libmysql – mysqlnd 5.0.12-dev – 20150407 – $Id: 3591daad22de08524295e1bd073aceeff11e6579 $
PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation
PHP Version: 7.4
PHP Location: /opt/remi/php74/root/usr/bin/php
Database server
Server: Localhost via UNIX socket
Server type: MariaDB
Server connection: SSL is not being used Documentation
Server version: 10.5.16-MariaDB – MariaDB Server
Protocol version: 10
User: cheapglasses@localhost
Server charset: cp1252 West European (latin1)
Redis
Version: 6
IP Address: 127.0.0.0
Port: 22264
Elasticsearch 7.9-latest
Endpoint: 127.0.0.0
Port: 58561
Here is the method I solved with this issue:
Replace session and cache related blocks to:
‘session’ => [
‘save’ => ‘files’
],
‘cache’ => [
‘frontend’ => [
‘default’ => [
‘id_prefix’ => ‘907_’
],
‘page_cache’ => [
‘id_prefix’ => ‘907_’
]
],
‘allow_parallel_generation’ => false
],
‘lock’ => [
‘provider’ => ‘db’,
‘config’ => [
‘prefix’ => ”
]
],
‘directories’ => [
‘document_root_is_pub’ => true
],
‘downloadable_domains’ => [
],
‘cache_types’ => [
‘config’ => 1,
‘layout’ => 1,
‘block_html’ => 1,
‘collections’ => 1,
‘reflection’ => 1,
‘db_ddl’ => 1,
‘compiled_config’ => 1,
‘eav’ => 1,
‘customer_notification’ => 1,
‘config_integration’ => 1,
‘config_integration_api’ => 1,
‘full_page’ => 1,
‘config_webservice’ => 1,
‘translate’ => 1,
‘amasty_shopby’ => 1
],
Then run:
bin/magento setup:config:set –cache-backend=redis –cache-backend-redis-server=127.0.0.0 –cache-backend-redis-port=6379 –cache-backend-redis-db=0
bin/magento setup:config:set –page-cache=redis –page-cache-redis-server=127.0.0.0 –page-cache-redis-port=6379 –page-cache-redis-db=1
bin/magento setup:config:set –session-save=redis –session-save-redis-host=127.0.0.0 –session-save-redis-port=6379 –session-save-redis-log-level=4 –session-save-redis-db=2
If you use dedicated redis server, say the server ip is: 209.126.25.248, and the port is 22264, run:
bin/magento setup:config:set –cache-backend=redis –cache-backend-redis-server=209.126.25.248 –cache-backend-redis-port=22264 –cache-backend-redis-db=0
bin/magento setup:config:set –page-cache=redis –page-cache-redis-server=209.126.25.248 –page-cache-redis-port=22264 –page-cache-redis-db=1
bin/magento setup:config:set –session-save=redis –session-save-redis-host=209.126.25.248 –session-save-redis-port=22264 –session-save-redis-log-level=4 –session-save-redis-db=2
Here you can also change database number.
More from from: https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/cache/redis/redis-pg-cache