Skip to main content

Installing memcache and memcached with EasyApache4

Comments

29 comments

  • cPMarkF
    The following post is intended for the previous workaround instructions for the Memcache and Memcached PHP extensions in EasyApache 4 created prior to the existence of the packaged offered in the EA4 Experimental Repo: [SPOILER="Memcached igbinary support"> Let's have more fun. Need igbinary support in memcached? If you've done all the steps above, you need to remove the source directory of memcached-2.2.0 and untar the tarball again to get a fresh directory. Download and install igbinary from PECL:
    wget https://pecl.php.net/get/igbinary-1.2.1.tgz tar -vxzf igbinary-1.2.1.tgz cd igbinary-1.2.1 /opt/cpanel/ea-php56/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config make && make install
    Create your igbinary.ini
    echo 'extension=igbinary.so' >> /opt/cpanel/ea-php56/root/etc/php.d/igbinary.ini
    Go into your newly re-extracted memached-2.2.0 directory and rebuild memcached, enabling igbinary support (note: if you've already built memcached using the previous steps outlined above in this thread, you do not need to create or echo the module into the memcached.ini again)
    cd memcached-2.2.0 /opt/cpanel/ea-php56/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config --enable-memcached-igbinary
    During the config.status output, you should see these lines:
    checking whether to enable memcached igbinary serializer support... yes checking for memcached igbinary support... enabled
    If not, make sure you followed the steps above to install igbinary. If so, then:
    make && make install
    Afterwards, you should see igbinary support not only in PHP, but also for memcached:
    [17:21:38 sg root@server ~/memcached-2.2.0]cPs# php -i | grep igbinary /opt/cpanel/ea-php56/root/etc/php.d/igbinary.ini, igbinary igbinary support => enabled igbinary version => 1.2.1 igbinary APC serializer ABI => 0 igbinary session support => yes igbinary.compact_strings => On => On igbinary support => yes memcached.serializer => igbinary => igbinary Registered serializer handlers => php_serialize php php_binary igbinary wddx
    Hope this helps!
    0
  • cPanelMichael
    Hello, We've updated this thread to include information about packages available in the EA4 experimental repo, and to update the manual workaround instructions to address some of the common problems reported during the installation process. Some of the previous posts to this thread were removed, with the solutions included in the updated instructions. Let us know if you have any questions. Thanks!
    0
  • Nirjonadda
    Hello, We've updated this thread to include information about packages available in the EA4 experimental repo, and to update the manual workaround instructions to address some of the common problems reported during the installation process. Some of the previous posts to this thread were removed, with the solutions included in the updated instructions. Let us know if you have any questions. Thanks!

    How to uninstall memcache-php71-pecl (manual install) Why EA 4 Using memcached Version 3.0.2? When memcached 3.0.3 stable Version? Do we need uninstall "PHP Pecl" Installer memcached (3.0.3) ?
    0
  • JacobPerkins
    How to uninstall memcache-php71-pecl (manual install) Why EA 4 Using memcached Version 3.0.2? When memcached 3.0.3 stable Version? Do we need uninstall "PHP Pecl" Installer memcached (3.0.3) ?

    Thanks for the feedback. This is an experimental module, so it won't receive full attention until we send it through the team and full QA processes. I'll attempt to get these modules update to the latest versions in the next day or so. Also, I do believe you will need to uninstall the previous module you had installed, to ensure no conflicts.
    0
  • Nirjonadda
    you will need to uninstall the previous module you had installed

    Then how to uninstall previous modules? I have installed this both modules with this this thread manually installing tutorials.
    0
  • cPanelMichael
    Then how to uninstall previous modules? I have installed this both modules with this this thread manually installing tutorials.

    Hello, You can remove the memcache.so module and memcache.ini/memcached.ini files. For instance, if you installed the Memcache and Memcached PECL modules for PHP 7.1, you'd run the following commands:
    rm /opt/cpanel/ea-php71/root/usr/lib64/php/modules/memcache.so rm /opt/cpanel/ea-php71/root/etc/php.d/memcache.ini rm /opt/cpanel/ea-php71/root/etc/php.d/memcached.ini
    Thank you.
    0
  • Nirjonadda
    Hello, You can remove the memcache.so module and memcache.ini/memcached.ini files. For instance, if you installed the Memcache and Memcached PECL modules for PHP 7.1, you'd run the following commands:
    rm /opt/cpanel/ea-php71/root/usr/lib64/php/modules/memcache.so rm /opt/cpanel/ea-php71/root/etc/php.d/memcache.ini rm /opt/cpanel/ea-php71/root/etc/php.d/memcached.ini
    Thank you.

    Still can not remove Memcache PECL modules for PHP 7.1, I have installed Memcache from this follow the steps listed below.
    mkdir /root/memcache-php71-pecl cd /root/memcache-php71-pecl wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip unzip NON_BLOCKING_IO_php7.zip cd pecl-memcache-NON_BLOCKING_IO_php7 /opt/cpanel/ea-php71/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config && make cp modules/memcache.so /opt/cpanel/ea-php71/root/usr/lib64/php/modules/ echo 'extension=memcache.so' >/opt/cpanel/ea-php71/root/etc/php.d/memcache.ini
    0
  • Nirjonadda

    [2017-03-23 23:40:27 +0600] info [xml-api] Installing : ea-php71-php-memcached-3.0.2-1.1.9.cpanel.x86_64 1/2 [2017-03-23 23:40:27 +0600] info [xml-api] Installing : ea-php71-php-memcache-3.0.8-1.3.8.cpanel.x86_64 2/2Purging all relevant cached command results
    @cPanelMichael Installed memcache-3.0.8 but still are showing Manual Installation Version 3.0.9-dev 45959
    0
  • cPanelMichael
    @cPanelMichael Installed memcache-3.0.8 but still are showing Manual Installation Version 3.0.9-dev

    That's actually the version provided by the RPM published to the EA4 experimental repo. Internal case EA-6097 is open to address that version number mismatch. I'll update this thread with more information on case EA-6097 once it's available, but keep in mind the RPM is still considered experimental. Thank you.
    0
  • fast lane
    Hello Everyone! PHP extensions for Memcache and Memcached are now available in the EasyApache 4 Experimental Repository. Here's the latest comment regarding this change from the memcached-in-easyapache4 feature request: Once you have reviewed the instructions and warnings on the Experimental Repository document, you can choose to enable the repo and install the packages via the following commands:
    yum install ea4-experimental yum install ea-php56-php-memcache yum install ea-php56-php-memcached
    Replace "php56" with the version of PHP you want to install the extensions on (e.g. php54, php55, php70). Let us know if you have any questions. Thanks! Note: The previous workaround instructions are also unsupported, but are provided below for reference: [SPOILER="Previous Workaround Instructions"> The following thread is intended to offer step-by-step instructions to administrators that would like to install the Memcached and Memcache PECL modules on EasyApache 4. I encourage anyone reviewing this thread to vote and add feedback to the following feature request if you'd like to see these options made available as native PHP options in EasyApache 4: MemcacheD in EasyApache4 To start, here's some background information about the packages installed with these instructions: [SPOILER="Background Notes"> libmemcached is an open source C/C++ client library and tools for the memcached server (memcached - a distributed memory object caching system). It has been designed to be light on memory usage, thread safe, and provide full access to server side methods. The PECL memcached package is an extension that uses the libmemcached library to provide API for communicating with memcached servers. The PECL memcache package is an extension allows you to work with memcached through handy OO and procedural interfaces. This guide does not cover installing the Memcached daemon. To begin the installation, first install cyrus-sasl-devel and lib-memcached using the following commands: [SPOILER="Install Lib-Memcached">
    yum install cyrus-sasl-devel mkdir /root/lib-memcached-install cd /root/lib-memcached-install wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz tar -xvzf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 ./configure make && make install
    Next, install the Memcached Pecl Module for each version of PHP active on your system. Note: Please see the post here if you are receiving popen() has been disabled for security reasons errors. [SPOILER="PHP 5.4 - Memcached PECL Module">
    mkdir /root/memcached-php54-pecl cd /root/memcached-php54-pecl /opt/cpanel/ea-php54/root/usr/bin/pecl download https://pecl.php.net/get/memcached-2.2.0.tgz tar -xvf memcached-2.2.0.tgz cd memcached-2.2.0 /opt/cpanel/ea-php54/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php54/root/usr/bin/php-config make && make install echo 'extension=memcached.so' >> /opt/cpanel/ea-php54/root/etc/php.d/memcached.ini
    [SPOILER="PHP 5.5 - Memcached PECL Module">
    mkdir /root/memcached-php55-pecl cd /root/memcached-php55-pecl /opt/cpanel/ea-php55/root/usr/bin/pecl download https://pecl.php.net/get/memcached-2.2.0.tgz tar -xvf memcached-2.2.0.tgz cd memcached-2.2.0 /opt/cpanel/ea-php55/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php55/root/usr/bin/php-config make && make install echo 'extension=memcached.so' >> /opt/cpanel/ea-php55/root/etc/php.d/memcached.ini
    [SPOILER="PHP 5.6 - Memcached PECL Module">
    mkdir /root/memcached-php56-pecl cd /root/memcached-php56-pecl /opt/cpanel/ea-php56/root/usr/bin/pecl download https://pecl.php.net/get/memcached-2.2.0.tgz tar -xvf memcached-2.2.0.tgz cd memcached-2.2.0 /opt/cpanel/ea-php56/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php56/root/usr/bin/php-config make && make install echo 'extension=memcached.so' >> /opt/cpanel/ea-php56/root/etc/php.d/memcached.ini
    [SPOILER="PHP 7.0 - Memcached PECL Module">
    mkdir /root/memcached-php70-pecl cd /root/memcached-php70-pecl /opt/cpanel/ea-php70/root/usr/bin/pecl download memcached tar -xvf memcached* cd memcached* /opt/cpanel/ea-php70/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config make && make install echo 'extension=memcached.so' >> /opt/cpanel/ea-php70/root/etc/php.d/memcached.ini
    [SPOILER="PHP 7.1 - Memcached PECL Module">
    mkdir /root/memcached-php71-pecl cd /root/memcached-php71-pecl /opt/cpanel/ea-php71/root/usr/bin/pecl download memcached tar -xvf memcached* cd memcached* /opt/cpanel/ea-php71/root/usr/bin/phpize ./configure --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config make && make install echo 'extension=memcached.so' >> /opt/cpanel/ea-php71/root/etc/php.d/memcached.ini
    Then, install the Memcache PECL module for each version of PHP active on your system. Note: Please see the post here if you are receiving popen() has been disabled for security reasons errors. [SPOILER="PHP 5.4 - Memcache PECL Module">
    /opt/cpanel/ea-php54/root/usr/bin/pecl install memcache echo 'extension=memcache.so' >> /opt/cpanel/ea-php54/root/etc/php.d/memcache.ini
    [SPOILER="PHP 5.5 - Memcache PECL Module">
    /opt/cpanel/ea-php55/root/usr/bin/pecl install memcache echo 'extension=memcache.so' >> /opt/cpanel/ea-php55/root/etc/php.d/memcache.ini
    [SPOILER="PHP 5.6 - Memcache PECL Module">
    /opt/cpanel/ea-php56/root/usr/bin/pecl install memcache echo 'extension=memcache.so' >> /opt/cpanel/ea-php56/root/etc/php.d/memcache.ini
    [SPOILER="PHP 7.0 - Memcache PECL Module">
    mkdir /root/memcache-php70-pecl cd /root/memcache-php70-pecl wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip unzip NON_BLOCKING_IO_php7.zip cd pecl-memcache-NON_BLOCKING_IO_php7 /opt/cpanel/ea-php70/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config && make cp modules/memcache.so /opt/cpanel/ea-php70/root/usr/lib64/php/modules/ echo 'extension=memcache.so' >/opt/cpanel/ea-php70/root/etc/php.d/memcache.ini
    [SPOILER="PHP 7.1 - Memcache PECL Module">
    mkdir /root/memcache-php71-pecl cd /root/memcache-php71-pecl wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip unzip NON_BLOCKING_IO_php7.zip cd pecl-memcache-NON_BLOCKING_IO_php7 /opt/cpanel/ea-php71/root/usr/bin/phpize && ./configure --enable-memcache --with-php-config=/opt/cpanel/ea-php71/root/usr/bin/php-config && make cp modules/memcache.so /opt/cpanel/ea-php71/root/usr/lib64/php/modules/ echo 'extension=memcache.so' >/opt/cpanel/ea-php71/root/etc/php.d/memcache.ini
    Finally, verify each version of PHP active on your system includes the Memcached and Memcache modules:
    /opt/cpanel/ea-php54/root/usr/bin/php -m |grep memcache /opt/cpanel/ea-php55/root/usr/bin/php -m |grep memcache /opt/cpanel/ea-php56/root/usr/bin/php -m |grep memcache /opt/cpanel/ea-php70/root/usr/bin/php -m |grep memcache /opt/cpanel/ea-php71/root/usr/bin/php -m |grep memcache
    Here's an example of the output you should see:
    # /opt/cpanel/ea-php70/root/usr/bin/php -m |grep memcache memcache memcached
    Let us know if you have any questions about these instructions. Thank you.

    After following these instructions I can't find the memcached config file anywhere. Memcached appears to be running but I can't telnet into it (telnet localhost 11211). Help? Also, for future reference how would I uninstall memcached (having followed your revised install instructions with the experimental repo).
    0
  • cPanelMichael
    After following these instructions I can't find the memcached config file anywhere. Memcached appears to be running but I can't telnet into it (telnet localhost 11211). Help?

    The daemon itself isn't offered through cPanel, but is generally started with a command such as:
    memcached -d -u nobody -m 1024 127.0.0.1 -p 11211
    As far as configuring it, there's a third-party URL that discusses this at: Memcache basic configuration
    Also, for future reference how would I uninstall memcached (having followed your revised install instructions with the experimental repo).

    You'd simply remove the packages with the YUM command:
    yum remove ea-php56-php-memcache yum remove ea-php56-php-memcached
    Thank you.
    0
  • fahl
    I have installed as in first post.46259 But no memcach.cfg in etc/sysconfig & using memcached -d -u nobody -m 1024 127.0.0.1 -p 11211 i get following error -bash: memcached: command not found Help needed please
    0
  • cPanelMichael
    Hello @fahl, What method did you use to install the Memcached daemon? This is separate to the PHP extensions referenced on this thread, and typically installed with a command such as:
    yum install memcached
    Thank you.
    0
  • fahl
    Getting this error when saving php.ini
    API failure: (XID cnefq8) 2 errors occurred: Error #1: The php.ini file contains an invalid line: "Module Settings". Error #2: The php.ini file contains an invalid line: "echo 'extension=memcache.so'".
    Placed at bottom of php.ini
    ; this value may still be overridden on a per-stream basis via the "capath" ; SSL stream context option. ;openssl.capath= ; Local Variables: ; tab-width: 4 echo 'extension=memcache.so' ; End:
    What am i doing wrong please Running php70
    0
  • cPanelMichael
    echo 'extension=memcache.so'

    This is the actual command to run as opposed to the entry that should appear in the /opt/cpanel/ea-php70/root/etc/php.d/memcached.ini file. This is the output you should see when running the "cat /opt/cpanel/ea-php70/root/etc/php.d/memcached.ini" command (when using the manual installations instructions):
    extension=memcached.so
    Thank you.
    0
  • Nirjonadda
    Internal case EA-6097 is open to address that version number mismatch.

    This issue still are not fixed ?
    0
  • cPanelMichael
    This issue still are not fixed ?

    That case is still open, and the module is still only available from the experimental repo. I'll update this thread as soon as there's progress on the case. Thank you.
    0
  • Nirjonadda
    @cPanelMichael I am getting To install the Memcached daemon with run this command:
    yum install ea-memcached
    Error Log:
    Transaction check error: file /usr/bin/memcached from install of ea-memcached-1.4.35-3.4.5.cpanel.x86_64 conflicts with file from package memcached-0:1.4.15-10.el7_3.1.x86_64 file /usr/share/man/man1/memcached.1.gz from install of ea-memcached-1.4.35-3.4.5.cpanel.x86_64 conflicts with file from package memcached-0:1.4.15-10.el7_3.1.x86_64 Error Summary
    I Think Its problem that previous install command "yum install memcached" ? Please let me know this fix. OK, I do remove "yum remove memcached" then Installed "yum install ea-memcached" But now no more working memcached and getting error Can't connect to:127.0.0.1:11211, Now we have removed "yum remove ea-memcached" then Installed "yum install memcached" then all are started working. Please let me know that why Memcached daemon "yum install ea-memcached" are not working?
    0
  • cPanelMichael
    But now no more working memcached and getting error Can't connect to:127.0.0.1:11211

    You'd need to manually start it using a command like the one referenced earlier in this thread. EX: memcached -d -u nobody -m 1024 127.0.0.1 -p 11211
    Keep in mind this module is still considered experimental and thus is not yet ready for production machines. Thank you.
    0
  • Nirjonadda
    You'd need to manually start it using a command like the one referenced earlier in this thread. EX: Keep in mind this module is still considered experimental and thus is not yet ready for production machines. Thank you.

    Then it's will run memcached from user nobody? What the difference from command "yum install memcached" and "yum install ea-memcached"? Does this correct steps?
    yum install ea-php71-php-memcache yum install ea-php71-php-memcached yum install memcached
    0
  • cPanelMichael
    Then it's will run memcached from user nobody?

    Right, as that's the user Apache runs as. Keep in mind this is unsupported, so you may want to consult with a qualified system administrator for help setting it up.
    What the difference from command "yum install memcached" and "yum install ea-memcached"?

    The primary difference is that one method installs Memcached manually using your CentOS repos, whereas the other method installs it as part of an EasyApache 4 RPM. With the EA4 experimental method, there is no SASL, and no per-user init files, which means it is not considered ready for shared environments. Thank you.
    0
  • Nirjonadda
    The primary difference is that one method installs Memcached manually using your CentOS repos, whereas the other method installs it as part of an EasyApache 4 RPM. With the EA4 experimental method, there is no SASL, and no per-user init files, which means it is not considered ready for shared environments.

    Is this any closer to production release ?
    0
  • cPanelMichael
    Is this any closer to production release ?

    There's no new information to report at this time. We'll update the feature request as soon as an update is available: MemcacheD in EasyApache4 Thank you.
    0
  • Nirjonadda
    There's no new information to report at this time. We'll update the feature request as soon as an update is available: MemcacheD in EasyApache4 Thank you.

    Also does its support PHP72 ?
    0
  • cPanelMichael
    Also does its support PHP72 ?

    No, the EA4 experimental repo does not support memcache/memcached with PHP 7.2 at this time. Thank you.
    0
  • joejordanbrown
    Any update with regards to SASL support and per-user init files?
    0
  • cPanelMichael
    Any update with regards to SASL support and per-user init files?

    Hello, There's no update to report at this time. I encourage you to subscribe to the feature request, as any updates will be posted there as soon as they are available: MemcacheD in EasyApache4 Thank you.
    0
  • ciao70
    Hello, Attention blog.cloudflare.com/memcrashed-major-amplification-attacks-from-port-11211/
    0
  • oah
    Hi i am reading the post in 2020 and wondering where are we now with the memcached? tried couple of threads but all of them led me here. @cPanelMichael What steps should be followed, what has been updated, what is the recommended way nowadays? Thank you guys. O.
    0

Please sign in to leave a comment.