How to install Redis server using yum command
yum install epel-release yum install redis -y systemctl start redis.service systemctl enable redis
N.B.: verificare se è presente l’estensione redis in Tools & Settings > PHP Settings > *any PHP 7.4 handler* (tutte le voci di php 7.4). In caso contrario installarlo con la seguente procedura.
How to install Redis server using yum command
/opt/plesk/php/7.4/bin/pecl install redis
Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in PEAR/PackageFile/v2/Validator.php on line 1933
PHP Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”? in /opt/plesk/php/7.4/share/pear/PEAR/PackageFile/v2/Validator.php on line 1933
29 source files, building
running: phpize
sh: phpize: command not found
ERROR: `phpize’ failed
In my case, I got above error, So I have installed devel package using below command.
yum install plesk-php74-devel
http://autoinstall.plesk.com/PHP74_17/dist-rpm-CentOS-7-x86_64/extra/plesk-php74-devel-7.4.7-1centos.7.200616.1427.x86_64.rpm: [Errno 14] HTTP Error 404 – Not Found ] 0.0 B/s | 0 B –:–:– ETA
Trying other mirror.
if you got error like below. Open file /etc/yum.conf and set “gpgcheck” value to “0” and run yum update
And we can see the Redis php extension rpm package is installing from Plesk repository. So in short we don’t need to install the Redis php extension in a Plesk server because its included by default. We only need to perform the install if its missing from the server. We can verify the extension using below command.
/opt/plesk/php/7.4/bin/php -m | grep redis redis
If its still not enabled try to issue below command
yum install plesk-php74-redis
Now if you still not succeeded with the yum install try the pecl install of Redis.
yum install plesk-php74-devel /opt/plesk/php/7.4/bin/phpize --version /opt/plesk/php/7.4/bin/pecl install redis echo "extension=redis.so" > /opt/plesk/php/7.4/etc/php.d/redis.ini plesk bin php_handler --reread
We should now be able to see the extension in Tools & Settings > PHP Settings > *any PHP 7.4 handler*
Install Redis-object-cache in WordPress
- Install plugin named Redis Object Cache plugin
- Go the Wp-Admin area of wordpress and click the “Object Cache” button.
- After that it will usually look like below.
Edit our wp-config.php and at the end of the file add the following lines. Note that string can be anything you want, as long as it’s unique (maybe not necessary)
define('WP_CACHE_KEY_SALT', 'string');
define('WP_CACHE', true);
Then, you can enable object-cache in the plugin settings page :
In order to test whether the WordPress install is cached by WordPress, issue “redis-cli monitor” command over SSH and click any link in the wp-admin area. The result should be like below. It means we can see log entries appear and that conclude WordPress is communicating with Redis.
If you used docker redis image, first connect to the docker command line and then use the “redis-cli monitor” command.
# redis-cli monitor
OK
1594726813.585189 [0 172.17.0.1:59832] "PING"
1594726813.585552 [0 172.17.0.1:59832] "INFO"
1594726813.587372 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:default:is_blog_installed"
1594726813.601559 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:options:notoptions"
1594726813.602196 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:options:alloptions"
1594726813.603121 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:site-options:1-notoptions"
1594726813.609017 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:userlogins:brads_y48002f9"
1594726813.609488 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:users:1"
1594726813.609909 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:user_meta:1"
1594726813.619404 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:options:can_compress_scripts"
1594726813.620616 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:transient:doing_cron"
1594726813.623672 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:site-transient:update_plugins"
1594726813.624146 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:site-transient:update_themes"
1594726813.624503 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:site-transient:update_core"
1594726813.628105 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:posts:3"
1594726813.628549 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:post_meta:3"
1594726813.639773 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:terms:last_changed"
1594726813.640300 [0 172.17.0.1:59832] "SET" "stringZ1k2KT1:terms:last_changed" "0.63991900 1594726813"
1594726813.640625 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:terms:get_terms-3dea143495e302bc1ab70ea89d560d6f-0.63991900 1594726813"
1594726813.641713 [0 172.17.0.1:59832] "SET" "stringZ1k2KT1:terms:1" "O:8:\"stdClass\":9:{s:7:\"term_id\";s:1:\"1\";s:4:\"name\";s:13:\"Uncategorized\";s:4:\"slug\";s:13:\"uncategorized\";s:10:\"term_group\";s:1:\"0\";s:16:\"term_taxonomy_id\";s:1:\"1\";s:8:\"taxonomy\";s:8:\"category\";s:11:\"description\";s:0:\"\";s:6:\"parent\";s:1:\"0\";s:5:\"count\";s:1:\"1\";}" "nx"
1594726813.642172 [0 172.17.0.1:59832] "GET" "stringZ1k2KT1:term_meta:1"
1594726813.642849 [0 172.17.0.1:59832] "SET" "stringZ1k2KT1:term_meta:1" "a:0:{}" "nx"
1594726813.643212 [0 172.17.0.1:59832] "SET" "stringZ1k2KT1:terms:get_terms-3dea143495e302bc1ab70ea89d560d6f-0.63991900 1594726813" "a:1:{i:0;O:8:\"stdClass\":9:{s:7:\"term_id\";s:1:\"1\";s:4:\"name\";s:13:\"Uncategorized\";s:4:\"slug\";s:13:\"uncategorized\";s:10:\"term_group\";s:1:\"0\";s:16:\"term_taxonomy_id\";s:1:\"1\";s:8:\"taxonomy\";s:8:\"category\";s:11:\"description\";s:0:\"\";s:6:\"parent\";s:1:\"0\";s:5:\"count\";s:1:\"1\";}}" "ex" "86400" "nx"
1594726813.645692 [0 172.17.0.1:59832] "ZADD" "stringZ1k2KT1:redis-cache:metrics" "1594726813" "i=9d9d985;h=553;m=12;r=97.9;b=23910;t=0.00756;c=21"
Fonte: https://supporthost.in/install-redis-on-a-plesk-server/


