{"id":8479,"date":"2023-03-12T21:13:20","date_gmt":"2023-03-12T21:13:20","guid":{"rendered":"https:\/\/www.geekdecoder.com\/?p=8479"},"modified":"2023-03-12T21:13:20","modified_gmt":"2023-03-12T21:13:20","slug":"install-redis-on-cpanel-server-and-add-redis-object-cache","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2023\/03\/12\/install-redis-on-cpanel-server-and-add-redis-object-cache\/","title":{"rendered":"Install Redis on cPanel Server and add Redis Object Cache to WordPress Sites"},"content":{"rendered":"\n<p>Redis is an open source, in-memory, key-value data store most commonly used as a primary database, cache, message broker, and queue. Redis delivers sub-millisecond response times, enabling fast and powerful real-time applications<\/p>\n\n\n\n<p>Redis Object Cache is a persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.For a faster cache plugin.<\/p>\n\n\n\n<p>What this means is that we can increase performance for your cPanel WordPress Site.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Now, first install Redis<\/p>\n\n\n\n<p>Install Epel<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n yum install epel-release\n<\/pre><\/div>\n\n\n<p>Install Redis Server<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nyum install redis\n<\/pre><\/div>\n\n\n<p>After successfully installation start the Redis service and enable to auto-start on system reboot.<\/p>\n\n\n\n<p>Enable<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsystemctl enable redis\n<\/pre><\/div>\n\n\n<p>Created symlink from \/etc\/systemd\/system\/multi-user.target.wants\/redis.service to \/usr\/lib\/systemd\/system\/redis.service.<\/p>\n\n\n\n<p>Start<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsystemctl start redis\n<\/pre><\/div>\n\n\n<p>Install Redis PHP extension<\/p>\n\n\n\n<p>You can install Redis PHP extension for all installed PHP version on your system or install for the active version only. We recommend to install for all versions.<\/p>\n\n\n\n<p>CLI Install<\/p>\n\n\n\n<p>Here are examples on CLI install.<\/p>\n\n\n\n<p>PHP 8.0<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/opt\/cpanel\/ea-php80\/root\/usr\/bin\/pecl install igbinary igbinary-devel redis\n<\/pre><\/div>\n\n\n<p>Output:<\/p>\n\n\n\n<p>You will see a choice for the following. Just hit Enter.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nenable igbinary serializer support? &#x5B;no] :\nenable lzf compression support? &#x5B;no] :\nenable zstd compression support? &#x5B;no] :\n<\/pre><\/div>\n\n\n<p>The install completes.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n...Build process completed successfully\nInstalling &#039;\/opt\/cpanel\/ea-php80\/root\/usr\/lib64\/php\/modules\/redis.so&#039;\ninstall ok: channel:\/\/pecl.php.net\/redis-5.3.7\nExtension igbinary enabled in php.ini\nExtension redis enabled in php.ini\nExtension redis enabled in php.ini\n<\/pre><\/div>\n\n\n<p>Check:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/opt\/cpanel\/ea-php80\/root\/usr\/bin\/php -m | grep redis\n<\/pre><\/div>\n\n\n<p>Output:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nredis\n<\/pre><\/div>\n\n\n<p>PHP 8.1<\/p>\n\n\n\n<p>Run the following:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/opt\/cpanel\/ea-php81\/root\/usr\/bin\/pecl install igbinary igbinary-devel redis\n<\/pre><\/div>\n\n\n<p>Output<\/p>\n\n\n\n<p>Hit Enter to accept defaults<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nenable igbinary serializer support? &#x5B;no] :\nenable lzf compression support? &#x5B;no] :\nenable zstd compression support? &#x5B;no] :\n<\/pre><\/div>\n\n\n<p>The install completes<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nBuild process completed successfully\nInstalling &#039;\/opt\/cpanel\/ea-php81\/root\/usr\/lib64\/php\/modules\/redis.so&#039;\ninstall ok: channel:\/\/pecl.php.net\/redis-5.3.7\nExtension igbinary enabled in php.ini\nExtension redis enabled in php.ini\nExtension redis enabled in php.ini\n<\/pre><\/div>\n\n\n<p>Check<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/opt\/cpanel\/ea-php81\/root\/usr\/bin\/php -m | grep redis\n<\/pre><\/div>\n\n\n<p>Output<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nredis\n<\/pre><\/div>\n\n\n<p>You can install to any PHP, just use the correct path.<\/p>\n\n\n\n<p>Next, install and Activate the Redis Object Cache plugin via the WordPress Dashboard.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-28-27.png\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"291\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-28-27.png\" alt=\"\" class=\"wp-image-8495\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-28-27.png 567w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-28-27-300x154.png 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/a><\/figure>\n\n\n\n<p>Configuring the plugin<\/p>\n\n\n\n<p>After installing and activating the plugin, go to WordPress -&gt; Settings -&gt; Redis and enable the cache and check if the plugin can connect automatically.<\/p>\n\n\n\n<p>By default the object cache will connect to Redis Server over TCP at 127.0.0.1:6379.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-33-20.png\"><img loading=\"lazy\" decoding=\"async\" width=\"606\" height=\"805\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-33-20.png\" alt=\"\" class=\"wp-image-8498\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-33-20.png 606w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-33-20-226x300.png 226w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-35-55.png\"><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"349\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-35-55.png\" alt=\"\" class=\"wp-image-8501\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-35-55.png 413w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-35-55-300x254.png 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/a><\/figure>\n\n\n\n<p>You should see the following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-37-17.png\"><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"572\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-37-17.png\" alt=\"\" class=\"wp-image-8503\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-37-17.png 457w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-16-37-17-240x300.png 240w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/a><\/figure>\n\n\n\n<p>Edit the wp-config.php for each site. <\/p>\n\n\n\n<p>When editing your wp-config.php file, it is important that WP_REDIS_* constants are defined high up in the file, above these lines:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/* That&#039;s all, stop editing! Happy publishing. *\/\nrequire_once(ABSPATH . &#039;wp-settings.php&#039;);\n<\/pre><\/div>\n\n\n<p>Here is a good starting point.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnano wp-config.php\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/\/ adjust Redis host and port if necessary \ndefine( &#039;WP_REDIS_HOST&#039;, &#039;127.0.0.1&#039; );\ndefine( &#039;WP_REDIS_PORT&#039;, 6379 );\n\n\/\/ change the prefix and database for each site to avoid cache data collisions\ndefine( &#039;WP_REDIS_PREFIX&#039;, &#039;my-site&#039; );\ndefine( &#039;WP_REDIS_DATABASE&#039;, 0 ); \/\/ 0-15\n\n\/\/ reasonable connection and read+write timeouts\ndefine( &#039;WP_REDIS_TIMEOUT&#039;, 1 );\ndefine( &#039;WP_REDIS_READ_TIMEOUT&#039;, 1 );\n<\/pre><\/div>\n\n\n<p>Check it in the WordPress Dashboard<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-17-32-41.png\"><img loading=\"lazy\" decoding=\"async\" width=\"434\" height=\"269\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-17-32-41.png\" alt=\"\" class=\"wp-image-8516\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-17-32-41.png 434w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2023\/03\/2023-03-12-17-32-41-300x186.png 300w\" sizes=\"auto, (max-width: 434px) 100vw, 434px\" \/><\/a><\/figure>\n\n\n\n<p>So this is a great cache plugin. For more information see: https:\/\/github.com\/rhubarbgroup\/redis-cache\/blob\/develop\/INSTALL.md<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redis is an open source, in-memory, key-value data store most commonly used as a primary database, cache, message broker, and queue. Redis delivers sub-millisecond response times, enabling fast and powerful real-time applications Redis Object Cache is a persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.For a faster &#8230; <a title=\"Install Redis on cPanel Server and add Redis Object Cache to WordPress Sites\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2023\/03\/12\/install-redis-on-cpanel-server-and-add-redis-object-cache\/\" aria-label=\"Read more about Install Redis on cPanel Server and add Redis Object Cache to WordPress Sites\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-8479","post","type-post","status-publish","format-standard","hentry","category-cpanel"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=8479"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/8479\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=8479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=8479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=8479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}