KNOWNHOST WIKI

User Tools

Site Tools


vps-hosting:install-memcached-on-centos-7-with-cpanel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vps-hosting:install-memcached-on-centos-7-with-cpanel [2018/12/04 09:10]
Derrick B. [Installing PHP memcache modules]
vps-hosting:install-memcached-on-centos-7-with-cpanel [2020/06/11 07:22] (current)
Karson N.
Line 5: Line 5:
 Memcached is a memory object caching system, which is used for speeding up a good majority of current web applications. Most applications that you can install as a web front or back-end, have support for memcaching to help distribute and relieve load from your server. Essentially, memcached helps make better use of your memory, regardless of which processes are using memory. Memcached is a memory object caching system, which is used for speeding up a good majority of current web applications. Most applications that you can install as a web front or back-end, have support for memcaching to help distribute and relieve load from your server. Essentially, memcached helps make better use of your memory, regardless of which processes are using memory.
  
 +\\
 ===== Installing memcached ===== ===== Installing memcached =====
  
 Before you can install memcached, you need to install the binaries responsible for the process. Before you can install memcached, you need to install the binaries responsible for the process.
 +<code>
 +  yum -y install libmemcached-devel memcached
 +</code>
  
-''yum -y install libmemcached-devel memcached''+{{:vps-hosting:yum_begin.png?nolink&800|}}
  
-{{:vps-hosting:yum_begin.png?direct&400|}}+**Note:** This may install several dependencies that are needed for memcached to work correctly.
  
-Note: This may install several dependencies that are needed for memcached to work correctly. +{{:vps-hosting:yum_end.png?nolink&800|}}
- +
-{{:vps-hosting:yum_end.png?direct&400|}}+
  
 Once the install is finished, you can start the memcached service: Once the install is finished, you can start the memcached service:
- +<code> 
-''systemctl start memcached''+  systemctl start memcached 
 +</code>
  
 To have memcached start on reboot, and persist until manually turned off, you should enable the service in systemd by typing the following command: To have memcached start on reboot, and persist until manually turned off, you should enable the service in systemd by typing the following command:
 +<code>
 +  systemctl enable memcached
 +</code>
  
-''systemctl enable memcached'' +{{:vps-hosting:systemd_enable.png?nolink&800|}}
- +
-{{:vps-hosting:systemd_enable.png?direct&400|}}+
  
 Your ConfigServer Security and Firewall (CSF) will likely notify you of an unknown process once it's been running for awhile. Since we know what this process is, and dont need to be notified by the firewall in the future, you need to add an ignore line in the Firewall's process ignore file, like so: Your ConfigServer Security and Firewall (CSF) will likely notify you of an unknown process once it's been running for awhile. Since we know what this process is, and dont need to be notified by the firewall in the future, you need to add an ignore line in the Firewall's process ignore file, like so:
  
-<code>echo "exe:/usr/bin/memcached" >> /etc/csf/csf.pignore</code>+<code> 
 +  echo "exe:/usr/bin/memcached" >> /etc/csf/csf.pignore 
 +</code>
  
-{{:vps-hosting:csf_pignore.png?direct&400|}}+{{:vps-hosting:csf_pignore.png?nolink&800|}}
  
 After this, restart CSF to register the changes: After this, restart CSF to register the changes:
 +<code>
 +  csf -ra
 +</code>
  
-''csf -ra'' +{{:vps-hosting:csf_restart.png?nolink&800|}}
- +
-{{:vps-hosting:csf_restart.png?direct&400|}}+
  
 Now you'll need to modify the default configuration file for memcached, which is located at __/etc/sysconfig/memcached__. You can modify this file with your favorite editor; I'll be using vim (''nano'' is another popular commandline editor). Now you'll need to modify the default configuration file for memcached, which is located at __/etc/sysconfig/memcached__. You can modify this file with your favorite editor; I'll be using vim (''nano'' is another popular commandline editor).
- +<code> 
-''vi /etc/sysconfig/memcached''+  vi /etc/sysconfig/memcached 
 +</code>
  
 You should see the following: You should see the following:
  
 <code> <code>
-PORT="11211" +  PORT="11211" 
-USER="memcached" +  USER="memcached" 
-MAXCONN="1024" +  MAXCONN="1024" 
-CACHESIZE="64" +  CACHESIZE="64" 
-OPTIONS=""+  OPTIONS=""
 </code> </code>
  
Line 58: Line 66:
  
 <code> <code>
-PORT="11211" +  PORT="11211" 
-USER="memcached" +  USER="memcached" 
-MAXCONN="1024" +  MAXCONN="1024" 
-CACHESIZE="1G" +  CACHESIZE="1G" 
-OPTIONS="-l 127.0.0.1"+  OPTIONS="-l 127.0.0.1"
 </code> </code>
  
-{{:vps-hosting:memcach_config.png?direct&400|}}+{{:vps-hosting:memcach_config.png?nolink&800|}}
  
 After you save your file, type the following command to restart both memcached and load the new configuration file: After you save your file, type the following command to restart both memcached and load the new configuration file:
 +<code>
 +  systemctl restart memcached
 +</code>
  
-''systemctl restart memcached'' +\\
 ===== Installing PHP memcache modules ===== ===== Installing PHP memcache modules =====
  
 Now that memcached is installed, you begin installing the PHP modules associated with communicating with the memcached interface. Most CMS and other web applications use PHP by default, so it's a good idea to install the modules. I will be showing the installation instructions for installing memcached on PHP56, and PHP7__*__ versions. Now that memcached is installed, you begin installing the PHP modules associated with communicating with the memcached interface. Most CMS and other web applications use PHP by default, so it's a good idea to install the modules. I will be showing the installation instructions for installing memcached on PHP56, and PHP7__*__ versions.
  
-We'll be using [[https://pecl.php.net/|PECL]] to install the memcached modules for our PHP installations. Keep in mind this is for EasyApache4 servers, and may not work as desired with EasyApache3. It is recommended that you upgrade your EasyApache3 installation to EasyApache4 before continuing.+We'll be using ((https://pecl.php.net/))[[https://pecl.php.net/|PECL]] to install the memcached modules for our PHP installations. Keep in mind this is for EasyApache4 servers, and may not work as desired with EasyApache3. It is recommended that you upgrade your EasyApache3 installation to EasyApache4 before continuing.
  
 For PHP56, the module is called "memcache", the following command will use the __P__HP __E__xtension __C__ommunity __L__ibrary to install the module on the specified version of PHP: For PHP56, the module is called "memcache", the following command will use the __P__HP __E__xtension __C__ommunity __L__ibrary to install the module on the specified version of PHP:
  
-<code>scl enable ea-php56 'pecl install memcache'</code>+<code> 
 +  scl enable ea-php56 'pecl install memcache' 
 +</code>
  
 During this module's install, just hit [Enter] when you're queried with the following: During this module's install, just hit [Enter] when you're queried with the following:
 +<code>
 +  Enable memcache session handler support? [yes] :
 +</code>
  
-''Enable memcache session handler support? [yes] :'' +{{:vps-hosting:php56_option.png?nolink&800|}}
- +
-{{:vps-hosting:php56_option.png?direct&400|}}+
  
 For PHP7__*__, the module is called ''memcached''. Replace the 0 with 1 or 2 for versions PHP71 and PHP72: For PHP7__*__, the module is called ''memcached''. Replace the 0 with 1 or 2 for versions PHP71 and PHP72:
  
-<code>scl enable ea-php70 'pecl install memcached'</code>+<code> 
 +  scl enable ea-php70 'pecl install memcached' 
 +</code>
  
 During this module's install, you'll be queried with the following - instead of pressing [Enter], type what's displayed below and then hit [Enter]: During this module's install, you'll be queried with the following - instead of pressing [Enter], type what's displayed below and then hit [Enter]:
 +<code>
 +  %%libmemcached directory [no] : no --disable-memcached-sasl%%
 +</code>
  
-''%%libmemcached directory [no] : no --disable-memcached-sasl%%'' +{{:vps-hosting:php7_option.png?nolink&800|}}
- +
-{{:vps-hosting:php7_option.png?direct&400|}}+
  
 Memcached SASL is a security layer which adds authentication support to memcached's protocols - you don't need this, and it's not recommended in an environment where multiple domains are being served, and may be using memcached. Memcached SASL is a security layer which adds authentication support to memcached's protocols - you don't need this, and it's not recommended in an environment where multiple domains are being served, and may be using memcached.
Line 102: Line 118:
  
 <code> <code>
-scl enable ea-php56 'php -m' | grep memcache +  scl enable ea-php56 'php -m' | grep memcache 
-scl enable ea-php70 'php -m' | grep memcached+  scl enable ea-php70 'php -m' | grep memcached
 </code> </code>
  
-{{:vps-hosting:modules_confirm.png?direct&400|}}+{{:vps-hosting:modules_confirm.png?nolink&800|}}
  
 Once you confirm the modules are installed, you will need to restart apache with the following command, to ensure the modules are loaded: Once you confirm the modules are installed, you will need to restart apache with the following command, to ensure the modules are loaded:
- +<code> 
-''systemctl restart httpd''+  systemctl restart httpd 
 +</code>
  
vps-hosting/install-memcached-on-centos-7-with-cpanel.1543936229.txt.gz · Last modified: 2018/12/04 09:10 by Derrick B.