How to install/uninstall memcached or memcache extension for Plesk PHP handlers?

Follow

Comments

42 comments

  • Avatar
    Nikita Nikushkin

    Hi @Marcel Aulenbacher,

    This error:

    "/opt/plesk/php/7.1/bin$ sudo pecl install memcached
    pecl/memcached requires PHP (version >= 7.0.0), installed version is 5.5.9-1ubuntu4.29
    pecl/memcached can optionally use PHP extension "igbinary" (version >= 2.0)
    pecl/memcached can optionally use PHP extension "msgpack" (version >= 2.0)
    No valid packages found
    install failed"

    Installed memcached version is the latest release 1.5.1

    is most probably occurs because sudoers run pecl under the system PHP

    I see that "php -v" returned the following:

    PHP 7.1.29 (cli) (built: May 6 2019 11:09:56) ( NTS )

    However, it returns the information for the Plesk PHP 7.1, not for the system one, for some reason

    I suggest repeat these steps:

    1. Login as a root user
    2. Run this command (without sudo):

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

    If the issue still occurs I suggest creating a request to the Support Department for further issue investigation:

    How to submit a request to Plesk support?

  • Avatar
    Lethalmiko

    @Nikita Nikushkin

    I actually ended up solving the problem myself with more research. What I did:

    ---

    # apt autoremove
    # apt install memcached
    # apt install autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php72-dev zlib1g-dev libsasl2-dev build-essential php7.2-dev

    # nano /usr/share/psa-pear/pear/pecl

    ---

    [Edited pecl file]

    Remove -n flag from the last line of /usr/share/psa-pear/pear/pecl utility. It is now:

    exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@"

    ---

    # /usr/share/psa-pear/pear/pecl install memcached
    [Installs to '/usr/lib/php/20170718/memcached.so']

    # echo "extension=memcached.so" > /etc/php/7.2/mods-available/memcached.ini
    # ln -s /etc/php/7.2/mods-available/memcached.ini /etc/php/7.2/cli/conf.d/20-memchached.ini
    # ln -s /etc/php/7.2/mods-available/memcached.ini /etc/php/7.2/fpm/conf.d/20-memchached.ini
    # plesk bin php_handler --reread
    # /etc/init.d/php7.2-fpm restart && /etc/init.d/apache2 restart && /etc/init.d/nginx restart

  • Avatar
    Remy Vaartjes

    On Plesk Onyx Web Pro Edition 17.5.3 + CentOS 7 I got this error:

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

    shtool at '/tmp/memcached/build/shtool' does not exist or is not executable.
    Make sure that the file exists and is executable and then rerun this script.
    ERROR: `phpize' failed

    Was solved by doing this first:
    mount -o remount,exec /tmp

    After that it installed properly with:
    /opt/plesk/php/7.1/bin/pecl install memcached

    See: https://support.plesk.com/hc/en-us/articles/115001406994-Error-while-using-pecl-install-shtool-at-tmp-does-not-exist-or-is-not-executable

  • Avatar
    Anna Morozyuk

    Hello @Lethalmiko,

    Thank you for the feedback! Other users may find this solution useful as well.

  • Avatar
    Maxim Krasikov (Edited )

    Hello @Marcel Aulenbacher!

    As I can see from the output provided, the command was executed under system PHP 5.5.9 but not under PHP 7.1.
    # /opt/plesk/php/7.1/bin$ sudo pecl install memcached

    Please install memcached using the commands provided in the instruction above in section "Memcached installation" for PHP 7.x.

  • Avatar
    Florian Thiel

    tried to follow the instruction for PHP 7.1 with Plesk 17.5.3 Update #38 on Ubuntu 14.04.5 but it stops with

    configure: error: no, libmemcached sasl support is not enabled. Run configure with --disable-memcached-sasl to disable this check.

    Tried with this flag but doesn't help. Any ideas?

  • Avatar
    Bulat Tsydenov

    @Gabriel De León, Hi!
    The article has been modified. Please check the instructions.

  • Avatar
    Ivan Postnikov

    Hi @Graham, glad to hear that this helped =)

  • Avatar
    Ivan Postnikov

    Hello @William,

    As I have checked on the test server with CentOS 6, when PHP 5.6 is installed, this file exists on the file system.

    Please, make sure that PHP 5.6 is installed in Plesk. If it is installed, try reinstalling it, it should resolve the issue.

  • Avatar
    Nick Plekhov

    Hello @Lobbe Maxime
    Thank you for bringing our attention to this.

    The article was outdated - there was no plesk-php73-devel in the preparation stage for RHEL-based OS.
    I have updated the article.

  • Avatar
    Nikita Nikushkin

    Hi @Marcel Aulenbacher,

    Please, run one of these commands to install the extension to the required Plesk PHP 7.X version:

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

    OR

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

    OR

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

    OR

    /opt/plesk/php/7.3/bin/pecl install memcached
  • Avatar
    Alexandr Tumanov

    @Miha, there is a possibility that package update removed the whole PHP folder taking the memcached. Please vote for adding it to Plesk packages https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/6594919-memcached-support 

  • Avatar
    Ivan Postnikov

    @Florian Thiel

    Hello!
    The libmemcached package for Ubuntu 14.04 does not support SASL authentication.
    Which error is displayed with the option -disable-memcached-sasl?

  • Avatar
    Kevin

    Package "plesk-php70-dev" or  "plesk-php71-dev" or  "plesk-php72-dev" not available for Debian 9 "stretch". Any chance on adding them?

  • Avatar
    Peter Westerlund

    Have installed it (on php 5.4 for centos) but can't start the server. Can't find the folder where it's installed. Where is it?

  • Avatar
    Pascal Devif

    Hello,

    Thanks for this tutorial.
    On debian 9, how to configure Memcached parameters (like memory) ?
    I found nothing in /etc

     

  • Avatar
    Marcel Aulenbacher (Edited )

    Hi @Nikita Nikushkin!

    Thank you for your input. As before mentioned and explained in my original post, this is exactly what I am doing with the root user. As furthermore described this results in the documented problems.

    The problem, as stated, is that apparantly the server tries to use PHP in the 5.6.9 version, even the root user is set to use PHP 7.1 for the execution of the commands.

    Regards!

  • Avatar
    Robert Asilbekov


    @Peter Westerlund

    The article is about installing php extension for memcached,  it is supposed that memcached server already installed. I think you just need to install memcached daemon.

     

    # yum install memcached

    or

    # apt-get install memcached

    You may also look at the blog post:  

    https://www.plesk.com/blog/product-technology/reduce-server-load-with-memcached/

  • Avatar
    Maxim Krasikov

    Hello @Mario !

    Since you use only PHP 7.3, you don't need to install plesk-php56-devel, plesk-php70-devel, plesk-php71-devel, and plesk-php72-devel packages.

    You may remove them using the following steps:

    1. List installed packages:
    # rpm -qa | grep devel | grep php
    plesk-php73-devel-7.3.5-1centos.7.190506.1021.x86_64
    plesk-php72-devel-7.2.18-1centos.7.190506.1021.x86_64
    plesk-php71-devel-7.1.29-1centos.7.190506.1021.x86_64
    plesk-php56-devel-5.6.40-centos7.19011112.x86_64


    2. Remove packages without dependensies one by one, for example:
    # rpm -evh --nodeps plesk-php56-devel
    # rpm -evh --nodeps plesk-php71-devel
    # rpm -evh --nodeps plesk-php72-devel

  • Avatar
    Ivan Postnikov

    Hello @Remy,

    Glad to hear that the solution helped!

  • Avatar
    William (Edited )

    Hi

     Centos6 /php5.6 server- was trying to install memcached extension   to be able to run WP caching

    Was following the above  instructions until i got to  # /opt/plesk/php/5.6/bin/pecl install memcached-2.2.0

    which yielded -bash: /opt/plesk/php/5.6/bin/pecl: No such file or directory

    only pecl i could find was /usr/share/psa-pear/pear/pecl

    I could yum install php-pear..  ? which would then  give  me /usr/bin/pecl   as well..

    Either way i am  nervous about conflicting versions and  breaking plesk and unsure how to proceed..

    Suggestions?

     

     

  • Avatar
    Gabriel De León

    Good morning,

    Is it possible to install memcached for the php 7.0.22 OS vendor?

    This article is fine, but it does not say how to install the module for your PHP 7.0.22 and I would need it.

    I have reviewed information and it is possible to compile it manually but I do not know if this will cause problems with your PLESK system.

    Can you confirm these points? Thank you very much.

  • Avatar
    Graham Jones

     

    Many thanks. Whoops...! That has now solved it.

  • Avatar
    Marcel Aulenbacher

    Hi! I am having issues on Ubuntu 14.04 Trusty with Plesk Onyx
    Version 17.8.11 Update #53

    I have different PHP Versions active on the server:
    5.5.9 which is solely needed by plesk in case I understand that right
    7.1 and 7.2

    I want to get memcached installed on the 7.1 and 7.2, yet I am using those PHP versions for the applications we are running.

    I get the following error following precisely the explanations given here:

    "/opt/plesk/php/7.1/bin$ sudo pecl install memcached
    pecl/memcached requires PHP (version >= 7.0.0), installed version is 5.5.9-1ubuntu4.29
    pecl/memcached can optionally use PHP extension "igbinary" (version >= 2.0)
    pecl/memcached can optionally use PHP extension "msgpack" (version >= 2.0)
    No valid packages found
    install failed"

    Installed memcached version is the latest release 1.5.1

    I am complying with each and any step given in the help section but there is no way to achieve it.

    Help would be much appreciated and thanks in advance!

  • Avatar
    Ivan Postnikov

    @Florian Thiel

    Hello!

    The issue requires mo detailed investigation, consider contacting Plesk Support.

    Also, consider contacting Ubuntu Support, as they are professionals in their product.

  • Avatar
    Ivan Postnikov

    @Kevin, make sure you do not have custom repositories on the server because the issue was not reproduced on a test server:

    # lsb_release -a

    No LSB modules are available.
    Distributor ID: Debian
    Description: Debian GNU/Linux 9.4 (stretch)
    Release: 9.4
    Codename: stretch
    # apt-get install plesk-php71-dev
    ...
    # dpkg -l | grep plesk-php71-dev
    ii plesk-php71-dev 7.1.16-debian9.0.18033013

  • Avatar
    Miha Gregorš

    After regular updates of php 5.6 I noticed that memcached stop working. I got error:

    PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/plesk/php/5.6/lib64/php/modules/memcache.so' - /opt/plesk/php/5.6/lib64/php/modules/memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0

    It looks like update of package remove my memcached :)

    Has anyone experienced similarly problem?

  • Avatar
    Lethalmiko

    All these instructions don't work on Ubuntu 18.04.2 LTS with Plesk Onyx 17.8.11 Update #48. I am running nginx as a full front-line web server with FPM, not as a proxy. PHP version 7.2.15 supplied by vendor. The phpinfo does not show  memcached support. I verified that memcached is working. It is memcached version 1.5.6.

    I did two methods and they both failed!!! I uninstalled everything in between the two methods. I am stuck and don't know what to do.

    METHOD 1:
    # apt autoremove
    # apt install memcached
    # apt install autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php72-dev zlib1g-dev libsasl2-dev build-essential php7.2-dev
    # /opt/plesk/php/7.2/bin/pecl install memcached
    # echo "extension=memcached.so" > /opt/plesk/php/7.2/etc/php.d/memcached.ini
    # plesk bin php_handler --reread
    # /etc/init.d/php7.2-fpm restart && /etc/init.d/apache2 restart && /etc/init.d/nginx restart

    METHOD 2:
    # apt autoremove
    # apt install memcached
    # apt install autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php72-dev zlib1g-dev libsasl2-dev build-essential php7.2-dev

    [Edit pecl file]
    # nano /usr/share/psa-pear/pear/pecl
    ---
    Removed -n flag from the last line of /usr/share/psa-pear/pear/pecl utility. It is now:

    exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv="On" $INCDIR/peclcmd.php "$@"
    ---

    # /opt/plesk/php/7.2/bin/pecl install memcached
    # echo "extension=memcached.so" > /etc/php/7.2/cli/conf.d/20-memcached.ini
    # plesk bin php_handler --reread
    # /etc/init.d/php7.2-fpm restart && /etc/init.d/apache2 restart && /etc/init.d/nginx restart

  • Avatar
    Enzonius

    On Plesk 17.8.11 Centos 6.10 I can't install memcached for php 7.3

    root@XXXXXXX [/etc/]# /opt/plesk/php/7.3/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.1.3.tgz ...
    Starting to download memcached-3.1.3.tgz (82,673 bytes)
    ....................done: 82,673 bytes

    Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in PEAR/PackageFile/v2/Validator.php on line 1933
    PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /opt/plesk/php/7.3/share/pear/PEAR/PackageFile/v2/Validator.php on line 1933
    15 source files, building
    running: phpize
    Configuring for:
    PHP Api Version: 20180731
    Zend Module Api No: 20180731
    Zend Extension Api No: 320180731
    configure.ac:3: error: Autoconf version 2.68 or higher is required
    configure.ac:3: the top level
    autom4te: /usr/bin/m4 failed with exit status: 63
    ERROR: `phpize' failed

    Current autoconf version:

    root@65dl-plmh[/etc]# autoconf --version
    autoconf (GNU Autoconf) 2.63
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv2+: GNU GPL version 2 or later
    <http://gnu.org/licenses/old-licenses/gpl-2.0.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by David J. MacKenzie and Akim Demaille.

     

    I've tried to install autoconf 2.69 with this:

    root@XXXXXXX[/etc]# curl -L -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
    tar zxf autoconf-2.69.tar.gz
    cd autoconf-2.69
    yum install -y openssl-devel
    ./configure
    make && make install

    But Plesk will only read 2.63. Is there a way to get Plesk to recognize the new installation? 

     

     

  • Avatar
    Florian Thiel

    @Ivan Postnikov

    the same error, it seems like the option is not detected. Tried it with -disable-memcached-sasl and --disable-memcached-sasl

Please sign in to leave a comment.

Have more questions? Submit a request