How to install/uninstall memcached PHP extension for Plesk PHP handlers

Follow

Comments

9 comments

  • Avatar
    Jason Cross

    Tried using these instructions and got an error when installing the PHP extension.

    /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=<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

    Ubuntu 22.04.3 LTS

    Plesk Obsidian 18.0.54

    0
    Comment actions Permalink
  • Avatar
    Permanently deleted user

    Hello Jason,

    It looks like some libraries are missing on the server. 
    You may either re-run the command below:

    # apt install memcached autoconf automake gcc libmemcached-dev libhashkit-dev pkg-config plesk-php*-dev zlib1g-dev make

    Or refer to the steps from the 'Installation errors and troubleshooting' section of the following article: https://support.plesk.com/hc/en-us/articles/12377140315671. 

    0
    Comment actions Permalink
  • Avatar
    Jason Cross

    Nothing appears to be missing.

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

    Reading package lists... Done

    Building dependency tree... Done

    Reading state information... Done

    Note, selecting 'plesk-php80-dev' for glob 'plesk-php*-dev'

    Note, selecting 'plesk-php81-dev' for glob 'plesk-php*-dev'

    Note, selecting 'plesk-php82-dev' for glob 'plesk-php*-dev'

    autoconf is already the newest version (2.71-2).

    automake is already the newest version (1:1.16.5-1.3).

    gcc is already the newest version (4:11.2.0-1ubuntu1).

    make is already the newest version (4.3-4.1build1).

    memcached is already the newest version (1.6.14-1).

    pkg-config is already the newest version (0.29.2-1ubuntu3).

    zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu9.2).

    libhashkit-dev is already the newest version (1.1.3-1+ubuntu22.04.1+deb.sury.org+1).

    libmemcached-dev is already the newest version (1.1.3-1+ubuntu22.04.1+deb.sury.org+1).

    plesk-php80-dev is already the newest version (8.0.29-ubuntu.22.04.230609.0738).

    plesk-php81-dev is already the newest version (8.1.21-ubuntu.22.04.230707.0437).

    plesk-php82-dev is already the newest version (8.2.8-ubuntu.22.04.230707.0437).

    0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

    0
    Comment actions Permalink
  • Avatar
    Onur YOK

    İ have a challenge for you. Memcached doesn't work anymore. I get always empty string. Memcached was working over a year without any problem... And now. Baaammm.. Any idea?

    0
    Comment actions Permalink
  • Avatar
    Pega Olymp (Edited )

    These instruction will be failed if you want to change "igbinary => yes" on Centos 7.9. Could you please check it again?

    /opt/plesk/php/7.4/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:         20190902
    Zend Module Api No:      20190902
    Zend Extension Api No:   320190902
    libmemcached directory [no] :
    zlib directory [no] :
    use system fastlz [no] : yes
    enable igbinary serializer [no] : yes
    enable msgpack serializer [no] :
    enable json serializer [no] : yes
    enable server protocol [no] :
    enable sasl [yes] :
    enable sessions [yes] :
    building in /tmp/pear-build-rootpvSZfO/memcached-3.2.0
    running: /tmp/memcached/configure --with-php-config=/opt/plesk/php/7.4/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=no --with-system-fastlz --enable-memcached-igbinary=yes --enable-memcached-msgpack=no --enable-memcached-json=yes --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 we are using the GNU C compiler... yes
    checking whether cc accepts -g... yes
    checking for cc option to accept ISO C89... 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 -R... no
    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/7.4
    checking for PHP includes... -I/opt/plesk/php/7.4/include/php -I/opt/plesk/php/7.4/include/php/main -I/opt/plesk/php/7.4/include/php/TSRM -I/opt/plesk/php/7.4/include/php/Zend -I/opt/plesk/php/7.4/include/php/ext -I/opt/plesk/php/7.4/include/php/ext/date/lib
    checking for PHP extension directory... /opt/plesk/php/7.4/lib64/php/modules
    checking for PHP installed headers prefix... /opt/plesk/php/7.4/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... yes
    checking whether to enable memcached json serializer support... yes
    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... yes
    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/7.4/include/php
    checking for json includes... /opt/plesk/php/7.4/include/php
    checking for igbinary includes... configure: error: Cannot find igbinary.h
    ERROR: `/tmp/memcached/configure --with-php-config=/opt/plesk/php/7.4/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=no --with-system-fastlz --enable-memcached-igbinary=yes --enable-memcached-msgpack=no --enable-memcached-json=yes --enable-memcached-protocol=no --enable-memcached-sasl=yes --enable-memcached-session=yes' failed
    0
    Comment actions Permalink
  • Avatar
    Peter Debik

    @Pega Olymp igbinary is an optional component. If it is not installed on your server and you try to use it, the installation of the PHP memcached extension will fail. That is an expected behavior. If you want to use igbinary, you first need to install it.

    0
    Comment actions Permalink
  • Avatar
    Pega Olymp (Edited )

    Anyway as a not Plesk expert, I would like to explain the my question's answer very basicly (because this support instruction has to be detailed by an expert).

    If you want to add igbinary or json or etc. support your php client, you have to install their devel rpm's. This will give you needed .h file but in an incorrect location, you have to copy it to correct location and try to install that support your php client again.

    0
    Comment actions Permalink
  • Avatar
    Pega Olymp
    This time uninstall is not working :(
     
    By copying needed .h files I have managed to install php memcached extension. But it did not run properly so I have decided to uninstall from console and plesk, it gives the same error.

    # /opt/plesk/php/7.4/bin/pecl uninstall memcached
    PHP Fatal error: Uncaught Error: Cannot use object of type PEAR_Error as array in /opt/plesk/php/7.4/share/pear/PEAR/Dependency2.php:1036
    Stack trace:
    #0 /opt/plesk/php/7.4/share/pear/PEAR/Installer.php(1669): PEAR_Dependency2->validatePackageUninstall()
    #1 /opt/plesk/php/7.4/share/pear/PEAR/Command/Install.php(997): PEAR_Installer->uninstall()
    #2 /opt/plesk/php/7.4/share/pear/PEAR/Command/Common.php(270): PEAR_Command_Install->doUninstall()
    #3 /opt/plesk/php/7.4/share/pear/pearcmd.php(310): PEAR_Command_Common->run()
    #4 /opt/plesk/php/7.4/share/pear/peclcmd.php(32): require_once('/opt/plesk/php/...')
    #5 {main}
    thrown in /opt/plesk/php/7.4/share/pear/PEAR/Dependency2.php on line 1036
     
     
    0
    Comment actions Permalink
  • Avatar
    Peter Debik

    Pega Olymp As shown in the screenshot: "cannot find config for extension 'memcached'" causes the uninstall to fail. It's also seen in line #4. If the extension is no proper installation, it is expected that an automatic uninstall fails, because it cannot find the expected files.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request