Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Caching Server»How to Install Memcached on Debian 10/9/8

    How to Install Memcached on Debian 10/9/8

    RahulBy RahulMay 23, 20183 Mins ReadUpdated:June 5, 2019

    Memcached is a distributed memory object caching system, which stored data in memory on key-value basis. It is very useful for optimizing dynamic websites and enhanced speed by caching objects in memory. This article will help you to install Memcached with PHP Memcache extension on Debian 10, Debian 9 Stretch and Debian 8 Jessie systems.

    Step 1 – Install Memcached on Debian

    Update apt package cache on your system and then install Memcached on Debian system. Execute below commands on the terminal in your Debian system.

    sudo apt update
    sudo apt install memcached
    

    Step 2 – Memcached Configuration

    You can find the details information about Memcache configuration here. For inital level configuration check for the following settings under Memcache configuration file /etc/memcached.conf.

    • -d => Run Memcached in deamon mode.
    • -m => Maximum memory to be used by Memcached. (default: 64 MB)
    • -p => Define port for Memcached. (default: 11211)
    • -l => Define IP address to listen on. Use 0.0.0.0 to listen on all IPs(enterfaces).

    After making changes, restart the Memcached service.

    Step 3 – Test Memcached Setup

    Use nc command to check Memcached status. This will show you the current statistics of running Memcached server. So the values may differ per installation.

    echo "stats" | nc localhost 11211
    
    STAT maxbytes 67108864
    STAT maxconns 1024
    STAT tcpport 11211
    STAT udpport 0
    STAT inter 127.0.0.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 4
    STAT stat_key_prefix :
    STAT detail_enabled no
    STAT reqs_per_event 20
    STAT cas_enabled yes
    STAT tcp_backlog 1024
    STAT binding_protocol auto-negotiate
    STAT auth_enabled_sasl no
    STAT item_size_max 1048576
    STAT maxconns_fast no
    STAT hashpower_init 0
    STAT slab_reassign no
    STAT slab_automove 0
    STAT slab_chunk_max 1048576
    STAT lru_crawler no
    STAT lru_crawler_sleep 100
    STAT lru_crawler_tocrawl 0
    STAT tail_repair_time 0
    STAT flush_enabled yes
    STAT hash_algorithm jenkins
    STAT lru_maintainer_thread no
    STAT hot_lru_pct 32
    STAT warm_lru_pct 32
    STAT expirezero_does_not_evict no
    STAT idle_timeout 0
    STAT watcher_logbuf_size 262144
    STAT worker_logbuf_size 65536
    STAT track_sizes no
    END
    

    Step 4 – Install Memcached PHP Extension

    Execute the following command to install PHP Memcached extension on your system.

    sudo apt install php-memcached 
    

    After completing the installation, you must restart the Apache service to reload all settings.

    phpenmod memcached
    sudo service apache2 restart
    

    All done, You can now test Memcache PHP extension is enabled and working properly by creating an info.php file using the following code.

    1
    2
    3
    <?php
      phpinfo();
    ?>

    Now copy info.php file on Apache document root and access on the web interface. Search for the Memcache, You will get the result like below.

    Install memcached, PHP, Ubuntu

    cachingserver memcache memcached
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install Cordova on Fedora 32/31/30
    Next Article How To Install Docker on Ubuntu 18.04 & 16.04 LTS

    Related Posts

    How To Install Memcached on Ubuntu 20.04

    3 Mins Read

    How To Install Memcached on CentOS/RHEL 8

    Updated:August 8, 20201 Min Read

    How To Install Redis on Debian 10

    Updated:July 7, 20203 Mins Read

    How to Install Redis on Ubuntu 20.04

    3 Mins Read

    How To Install Memcached on Fedora 35/34/33

    Updated:April 18, 20223 Mins Read

    How To Delete All Data in Redis

    Updated:February 27, 20201 Min Read

    1 Comment

    1. Very Siberian on January 24, 2022 7:55 pm

      Thanks for helpful tutorial! Any idea how to do this for PHP 7.4 when using deb.sury.org as the repo?

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.