{"id":1498,"date":"2014-12-30T01:44:32","date_gmt":"2014-12-30T01:44:32","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=1498"},"modified":"2014-12-30T01:44:32","modified_gmt":"2014-12-30T01:44:32","slug":"install-memcache-centos-whmcpanel","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/12\/30\/install-memcache-centos-whmcpanel\/","title":{"rendered":"Install Memcache on WHM\/cPanel or CentOS"},"content":{"rendered":"<p>Memcached (Memcache Daemon) is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory. It is commonly used to speed up dynamic database-driven websites by caching data and objects in server memory to reduce the number of times the data source must be read. Memcached is free and open-source software, licensed under the Revised BSD license. Also, there are PHP extensions which allow you to work with memcached. There are two PHP memcache extensions available from the PHP Extension Community Library, PHP memcached and PHP memcache.<\/p>\n<h2>PHP Memcache vs PHP Memcached<\/h2>\n<p>These two PHP extensions are not identical. PHP Memcache is older, very stable but has a few limitations. The PHP memcache module utilizes the daemon directly while the PHP memcached module uses the libMemcached client library and also contains some added features.<\/p>\n<h2>Installing Memcache Daemon + PHP memcache or PHP memcached<\/h2>\n<p>Before selecting a PHP extension be sure to install the memcache daemon.<\/p>\n<p>How-To: Install Memcache on CentOS (WHM\/cPanel)<\/p>\n<ol>\n<ol>\n<li>Login into your WHM panel and using easyapache to enable Memcache<\/li>\n<\/ol>\n<\/ol>\n<p>Go to Software &#8211; Module Installers &#8211; PHP Pecl. Search for memcache and then install both memcache and memcached<br \/>\nRestart apache:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># service httpd restart\n\n<\/pre>\n<p>Check your memcached server is running successfully: ps -eaf | grep memcached<\/p>\n<h2>Installing Memcache Daemon + PHP memcache or PHP memcached on CentOS or Ubuntu<\/h2>\n<p>Before selecting a PHP extension be sure to install the memcache daemon:<\/p>\n<p>Centos \/ Red Hat:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# yum install memcached\n\n<\/pre>\n<p>Ubuntu\/ Debian:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# apt-get update\n# apt-get install memcached\n\n<\/pre>\n<p>After installing Memcached, open the configuration file for Memcached and make any changes:<\/p>\n<p>Centos \/ Red Hat:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# nano \/etc\/sysconfig\/memcached\n\n<\/pre>\n<p>Ubuntu \/ Debian:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# nano \/etc\/memcached.conf\n\n<\/pre>\n<p>Exit and save the configuration file, and then restart Memcached<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# service memcached restart\n\n<\/pre>\n<p>Remember to set the memcache daemon to start on server boot.<br \/>\nCentos \/ Red Hat:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# chkconfig memcached on\n\n<\/pre>\n<p>Ubuntu \/ Debian:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# update-rc.d memcached enable\n\n<\/pre>\n<p>Install a PHP memcache extension<\/p>\n<p>PHP memcache<\/p>\n<p>You can browse the version here &#8211; <a href=\"https:\/\/pecl.php.net\/package\/memcache\" target=\"_blank\" rel=\"noopener\">https:\/\/pecl.php.net\/package\/memcache<\/a> The current version as of this writing is 3.0.8<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nwget https:\/\/pecl.php.net\/get\/memcache-3.0.8.tgz\ntar xvf memcache-3.0.8.tgz\ncd memcache-3.0.8\nphpize\n.\/configure\nmake \nmake install\nmake test\nThen add memcache.so to your php.ini file:\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# nano \/etc\/php.ini\nextension=&quot;memcache.so&quot;\n\n<\/pre>\n<p>PHP memcached:<\/p>\n<p>Remember to install libmemcached dependancy (Ubuntu\/Debian):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nyum install cyrus-sasl-devel zlib-devel gcc-c++\nwget https:\/\/launchpad.net\/libmemcached\/1.0\/1.0.16\/+download\/libmemcached-1.0.16.tar.gz\ntar -xvf libmemcached-1.0.16.tar.gz\ncd libmemcached-1.0.16\n.\/configure --disable-memcached-sasl\nmake\nmake install\n\n<\/pre>\n<p>Then install PHP Memcached:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nwget https:\/\/pecl.php.net\/get\/memcached-3.0.8.tgz\ntar xf memcached-3.0.8.tgz\ncd memcached-3.0.8\nphpize\n.\/configure\nmake \nmake install\nmake test\n<\/pre>\n<p>Then add memcached.so to your php.ini file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nextension=&quot;memcached.so&quot;\n\n<\/pre>\n<p>You will need to connect your PHP application to memcached. For example, using W3 Total Cache with WordPress, memcached module with Drupal, Magento config, etc.<\/p>\n<p>Finally restart memcached, httpd (or apache, apache2 for Ubuntu\/Debian)<\/p>\n<p>If you would like to view stats of hit rate etc you can download memcachephp stats at GitHub &#8211; <a href=\"https:\/\/github.com\/DBezemer\/memcachephp\" target=\"_blank\" rel=\"noopener\">HERE<\/a>. Which will look something like this:<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2014\/12\/memcache.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2014\/12\/memcache-300x157.jpg\" alt=\"\" width=\"300\" height=\"157\" class=\"alignnone size-medium wp-image-3426\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2014\/12\/memcache-300x157.jpg 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2014\/12\/memcache-1024x537.jpg 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2014\/12\/memcache-768x403.jpg 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2014\/12\/memcache.jpg 1096w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Memcached (Memcache Daemon) is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory. It is commonly used to speed up dynamic database-driven websites by caching data and objects in server memory to reduce the number of times the data source must be read. Memcached is free &#8230; <a title=\"Install Memcache on WHM\/cPanel or CentOS\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/12\/30\/install-memcache-centos-whmcpanel\/\" aria-label=\"Read more about Install Memcache on WHM\/cPanel or CentOS\">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":[11,12,65,84],"tags":[],"class_list":["post-1498","post","type-post","status-publish","format-standard","hentry","category-centos6","category-centos-7","category-memcached","category-php"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1498","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=1498"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1498\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=1498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=1498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=1498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}