Step 2 – Memcached Configuration
You’ve got efficiently put in Memcached server. Now configure your Memcache server for varied choices.
Memcached service configuration file is /and so on/sysconfig/memcached, Edit the configuration file in your favourite textual content editor:
sudo vi /and so on/sysconfig/memcached
Now replace the next values as per your necessities.
Right here the choices are:
- PORT – Outline the port quantity to Memcahe service hear on. The default Memcached port is 11211.
- USER – Set the username underneath which the Memcached service run
- MAXCONN – Set the utmost connection to just accept at any time
- CACHESIZE – Set the cache restrict
- OPTIONS – You an go further choices to service. The -l choice is used to outline ip handle to which software hear for. You possibly can change this worth to LAN/WAN IP to permit Memcache to hear for distant addresses.
Save your file and shut it.
Step 3 – Handle Memcached Service
Now begin Memcached service by working the next command.
sudo systemctl begin memcached
You additionally must allow Memcached service to begin on system boot. Run beneath command to do that:
sudo systemctl allow memcached
The Memcached service is up and working now. To view the stats of the Memcached service, execute following command from terminal. It will present all particulars concerning the Memcached service.
echo “stats settings” | nc localhost 11211
STAT maxbytes 67108864
STAT maxconns 1024
STAT tcpport 11211
STAT udpport 0
STAT inter 127.0.0.1,::1
STAT verbosity 0
STAT oldest 0
STAT evictions on
STAT domain_socket NULL
STAT umask 700
STAT growth_factor 1.25
STAT chunk_size 48
STAT num_threads 4
STAT num_threads_per_udp 1
STAT stat_key_prefix :
Step 4 – Alter Firewall Guidelines
Moreover, we have to enable visitors to the Memcached server by opening the default port ( port 11211) on the firewall.
Subsequently, run the instructions beneath:
sudo firewall-cmd –zone=public –permanent –add-port=11211/tcp
sudo firewall-cmd –reload
Step 5 – Set up PHP Memcached Extension
To attach Memcache service from a PHP based mostly purposes, you might want to set up Memcache PHP extension. This extension have to be put in on the identical server the place PHP software is working on. In case your PHP software additionally working with CentOS/RHEL Eight system, observe beneath directions to allow Memcached extension.
There are two sort of extensions obtainable for PHP. First is Memcache is utilized by earlier model of PHP purposes. The newest PHP Software’s makes use of “Memcached” extension. The beneath instructions will set up each (Memcache and Memcached) extension in your CentOS Eight and RHEL Eight system.
sudo dnf set up epel-release -y
sudo dnf set up https://rpms.remirepo.internet/enterprise/remi-release-8.rpm -y
sudo dnf module reset php
sudo dnf module allow php:remi-7.4 -y
sudo dnf set up php-pecl-memcached php-pecl-memcache -y
Restart Apache service to allow extension
sudo systemctl restart httpd.service
Now verify if memcache PHP extension is enabled and dealing correctly. Create a phpinfo.php file utilizing following code
sudo vi /var/www/html/phpinfo.php
Now entry phpinfo.php on net interface and seek for Memcache or Memcached, You’re going to get outcome like beneath.
On this tutorial you’ve gotten discovered to put in Memcached caching server on CentOS/RHEL Eight system. Additionally put in PHP Memcached extension.
php memcached,centos 8 php memcached,linux 8 tutorial,php-pecl-memcache centos 8,install memcached php centos,install memcached centos 7,how to install memcached in linux,tecmint