Bobcares

Plesk Install memcached | How to ?

by | Jul 13, 2022

Memcached installation in Plesk gives us access to a powerful and cost-free object caching system to enhance website performance.

As part of our Plesk Hosting Support Service, Bobcares responds to all inquiries, no matter how trivial.

Let’s examine the how our Support team install memcached in Plesk.

Memcached installation in Plesk

Memcached is a high-performance, distributed memory caching system that is free and open source with the goal of accelerating dynamic web applications by minimising database load. Basically, it is a key-value dictionary of strings, objects, and other data that was rendered from a page, an API call, or a database call and is kept in memory.

plesk install memcached

Memcached won’t function unless the daemon, PHP libraries, and our PHP application are installed and configured correctly.

Steps to install Memcached

Generally, we use the command line to install the PHP libraries for Memcached. So, to execute these commands, we must be log in as the root user.

  1. Firstly, establish an SSH connection to a Plesk server and set up the environment.

    on CentOS/RHEL
    yum install make memcached gcc libmemcached-devel zlib-devel plesk-php*-devel

    on Debian/Ubuntu
    apt install memcached autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php*-dev zlib1g-dev make

  2. Then, install the memcached PHP extension.

    /opt/plesk/php/7.4/bin/pecl install memcached

  3. They, need additional parameters during installation. So, to install memcached with default settings or to enter required values, press Enter after each option.


    libmemcached directory [no] :

    zlib directory [no] :

    use system fastlz [no] :

    enable igbinary serializer [no] :

    enable msgpack serializer [no] :

    enable json serializer [no] :

    enable server protocol [no] :

    enable sasl [yes] :

    enable sessions [yes] :

  4. Then, register the extension in the PHP configuration file.

    echo "extension=memcached.so" > /opt/plesk/php/7.4/etc/php.d/memcached.ini

  5. Update the information on PHP handlers:

    plesk bin php_handler --reread

  6. Then, restart the PHP-FPM service.

    service plesk-php74-fpm restart

  7. Then, restart the Apache service:

    on CentOS/RHEL
    service httpd restart

    on Debian/Ubuntu
    service apache2 restart

  8. Finally, make sure the memcached module is installed:

    /opt/plesk/php/7.4/bin/php -m | grep memcached

[Looking for a solution to another query? We are just a click away.]

Conclusion

To sum up, we can install Memcached to enhance the performance of our website. Above all it is a powerful and free object caching system. How to install Memcached in Plesk is demonstrated by our Support team.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

4 Comments

  1. John

    THANK YOU! I have been trying to get this installed for awhile now and your article was exactly what I needed. Thank you!

    Reply
    • Hiba Razak

      Thanks for the feedback.We are glad to know that it worked for you ? .

      Reply
  2. Jason

    Something on this doesn’t appear to be working any longer.

    We are working on getting a new Ubuntu Plesk server running with memcached and keep running into errors when setting it up for PHP.

    Using the instructions we run the following successfully:

    apt install memcached autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php*-dev zlib1g-dev make
    But we run into an issue once we try to install the PHP extension (in our case for PHP 8.1)

    /opt/plesk/php/8.1/bin/pecl install memcached

    WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update
    pecl/memcached can optionally use PHP extension “igbinary” (version >= 2.0)
    pecl/memcached can optionally use PHP extension “msgpack” (version >= 2.0)
    downloading memcached-3.2.0.tgz …
    Starting to download memcached-3.2.0.tgz (90,722 bytes)
    …………………done: 90,722 bytes
    18 source files, building
    running: phpize
    Configuring for:
    PHP Api Version: 20210902
    Zend Module Api No: 20210902
    Zend Extension Api No: 420210902
    configure.ac:18: warning: $as_echo is obsolete; use AS_ECHO([“message”]) instead
    build/php.m4:2111: PHP_CONFIG_NICE is expanded from…
    configure.ac:18: the top level
    configure.ac:161: warning: The macro `AC_PROG_LIBTOOL’ is obsolete.
    configure.ac:161: You should run autoupdate.
    build/libtool.m4:99: AC_PROG_LIBTOOL is expanded from…
    configure.ac:161: the top level
    libmemcached directory [no] :
    zlib directory [no] :
    use system fastlz [no] :
    enable igbinary serializer [no] :
    enable msgpack serializer [no] :
    enable json serializer [no] :
    enable server protocol [no] :
    enable sasl [yes] :
    enable sessions [yes] :
    building in /tmp/pear-build-rootFGnoXE/memcached-3.2.0
    running: /tmp/memcached/configure –with-php-config=/opt/plesk/php/8.1/bin/php-config –with-libmemcached-dir=no –with-zlib-dir=no –with-system-fastlz=no –enable-memcached-igbinary=no –enable-memcached-msgpack=no –enable-memcached-json=no –enable-memcached-protocol=no –enable-memcached-sasl=yes –enable-memcached-session=yes
    checking for grep that handles long lines and -e… /usr/bin/grep
    checking for egrep… /usr/bin/grep -E
    checking for a sed that does not truncate output… /usr/bin/sed
    checking for pkg-config… /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0… yes
    checking for cc… cc
    checking whether the C compiler works… yes
    checking for C compiler default output file name… a.out
    checking for suffix of executables…
    checking whether we are cross compiling… no
    checking for suffix of object files… o
    checking whether the compiler supports GNU C… yes
    checking whether cc accepts -g… yes
    checking for cc option to enable C11 features… none needed
    checking how to run the C preprocessor… cc -E
    checking for icc… no
    checking for suncc… no
    checking for system library directory… lib
    checking if compiler supports -Wl,-rpath,… yes
    checking build system type… x86_64-pc-linux-gnu
    checking host system type… x86_64-pc-linux-gnu
    checking target system type… x86_64-pc-linux-gnu
    checking for PHP prefix… /opt/plesk/php/8.1
    checking for PHP includes… -I/opt/plesk/php/8.1/include/php -I/opt/plesk/php/8.1/include/php/main -I/opt/plesk/php/8.1/include/php/TSRM -I/opt/plesk/php/8.1/include/php/Zend -I/opt/plesk/php/8.1/include/php/ext -I/opt/plesk/php/8.1/include/php/ext/date/lib
    checking for PHP extension directory… /opt/plesk/php/8.1/lib/php/modules
    checking for PHP installed headers prefix… /opt/plesk/php/8.1/include/php
    checking if debug is enabled… no
    checking if zts is enabled… no
    checking for gawk… gawk
    checking whether to enable memcached support… yes, shared
    checking for libmemcached… yes, shared
    checking whether to enable memcached session handler support… yes
    checking whether to enable memcached igbinary serializer support… no
    checking whether to enable memcached json serializer support… no
    checking whether to enable memcached msgpack serializer support… no
    checking whether to enable memcached sasl support… yes
    checking whether to enable memcached protocol support… no
    checking whether to use system FastLZ library… no
    checking for ZLIB… yes, shared
    checking for pkg-config… /usr/bin/pkg-config
    checking for zlib location… /usr
    checking for session includes… /opt/plesk/php/8.1/include/php
    checking for memcached session support… enabled
    checking for memcached igbinary support… disabled
    checking for memcached msgpack support… disabled
    checking for libmemcached location… configure: error: memcached support requires libmemcached. Use –with-libmemcached-dir= to specify the prefix where libmemcached headers and library are located
    ERROR: `/tmp/memcached/configure –with-php-config=/opt/plesk/php/8.1/bin/php-config –with-libmemcached-dir=no –with-zlib-dir=no –with-system-fastlz=no –enable-memcached-igbinary=no –enable-memcached-msgpack=no –enable-memcached-json=no –enable-memcached-protocol=no –enable-memcached-sasl=yes –enable-memcached-session=yes’ failed
    I noticed it referenced an error with the pecl channel at the beginning so I ran:

    pecl channel-update pecl.php.net
    But after the result was the same.

    Ubuntu 22.04.3 LTS

    Plesk Obsidian 18.0.54

    Reply
    • Hiba Razak

      Hi,
      Our experts can help you with the issue.we will be happy to talk to you through our live chat(click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.