phpmemcachedyumamazon-linux-2amazon-linux-extras

How can I resolve yum install errors (dependency problems) when attempting to install php-memcached on PHP 8 on Amazon Linux 2?


I'm trying to install the PHP module "memcached" on PHP 8.0.18 using Amazon Linux 2:

PHP 8.0.18 (cli) (built: May 16 2022 19:07:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.18, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.18, Copyright (c), by Zend Technologies

It is working for me on PHP 7.4:

$ php -v
PHP 7.4.29 (cli) (built: May 12 2022 20:27:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.29, Copyright (c), by Zend Technologies
$ php -m
[PHP Modules]
[...]
memcached
[...]

I used this command to previously install memcached:

sudo yum install php-memcached

When I try to run this command on PHP 8.0.18 I get this error:

Error: Package: php-pecl-memcached-2.2.0-1.el7.x86_64 (epel)
           Requires: php(zend-abi) = 20100525-64
           Installed: php-common-8.0.18-1.amzn2.x86_64 (@amzn2extra-php8.0)
               php(zend-abi) = 20200930-64
           Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
               php(zend-abi) = 20100525-64
[...]
Error: Package: php-pecl-msgpack-0.5.5-5.el7.x86_64 (epel)
           Requires: php(api) = 20100412-64
           Installed: php-common-8.0.18-1.amzn2.x86_64 (@amzn2extra-php8.0)
               php(api) = 20200930-64
           Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
               php(api) = 20100412-64
[...]
Error: Package: php-pecl-igbinary-1.2.1-1.el7.x86_64 (epel)
           Requires: php(api) = 20100412-64
           Installed: php-common-8.0.18-1.amzn2.x86_64 (@amzn2extra-php8.0)
               php(api) = 20200930-64
           Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
               php(api) = 20100412-64

For reference here is what the memcached packages look like:

$ sudo yum list | grep memcached
libmemcached.x86_64                  1.0.16-5.amzn2.0.2           @amzn2-core
libmemcached.i686                    1.0.16-5.amzn2.0.2           amzn2-core
libmemcached-devel.x86_64            1.0.16-5.amzn2.0.2           amzn2-core
memcached.x86_64                     1.4.15-10.amzn2.1.2          amzn2-core
memcached-devel.x86_64               1.4.15-10.amzn2.1.2          amzn2-core
opensips-memcached.x86_64            1.10.5-4.el7                 epel
php-ZendFramework-Cache-Backend-Libmemcached.noarch
php-pecl-memcached.x86_64            2.2.0-1.el7                  epel
php-pecl-memcached-debuginfo.x86_64  2.2.0-1.el7                  epel-debuginfo
python-memcached.noarch              1.48-4.amzn2                 amzn2-core
uwsgi-router-memcached.x86_64        2.0.18-8.el7                 epel

My understanding of the problem is that a new php-memcached was recently released with PHP 8 support (version 3.2.0 released on March 28, 2022): https://github.com/php-memcached-dev/php-memcached/releases

My guess here is that Amazon (or the epel repository) doesn't have this new version yet.

How can I proceed? Do I have to wait for Amazon? Is it safe to install the module from another location?


Solution

  • My goal here was to install the php-memcached module with PHP 8. This module was how I previously used to integrate with Amazon ElastiCache's memcache servers.

    The problem was that the module was not in the PHP 8 repository on Amazon. It was available on PHP 7.4.

    I had thought this would take time for Amazon to add this updated module, but 4 months have gone by and nothing has changed.

    I need to switch my servers to PHP 8, as PHP 7.4 is ending support, and did some more digging here. It turns out that a better solution would be to use the PHP Cluster Client that Amazon provides: https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/Appendix.PHPAutoDiscoverySetup.Installing.html#Appendix.PHPAutoDiscoverySetup.Installing.PHP7x.Ubuntu

    sudo yum install gcc-c++ zlib-devel
    wget https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.X/latest-64bit-<ARCH>-<OpenSSL>
    tar -zxvf latest-64bit-<ARCH>-<OpenSSL>
    sudo mv amazon-elasticache-cluster-client.so /usr/lib64/php/modules/
    

    The linked page gives more information.

    I was able to get the memcached client working with this page.