awslabs / aws-elasticache-cluster-client-memcached-for-php

Amazon ElastiCache Cluster Client is an enhanced PHP library to connect to ElastiCache clusters. This client library has been built upon libmemcached and is released under the Apache License.
Other
62 stars 33 forks source link

Support for 7.3 #27

Closed n10000k closed 5 years ago

n10000k commented 5 years ago

Hey,

When will 7.3 be supported?

My dockerfile:

FROM php:fpm

RUN apt-get update && apt-get install -y zlib1g-dev libicu-dev libpq-dev libmemcached-dev curl
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php/archive/php7.tar.gz" \
  && mkdir -p /usr/src/php/ext/memcached \
  && tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
  && docker-php-ext-configure memcached \
  && docker-php-ext-install memcached \
  && rm /tmp/memcached.tar.gz

RUN docker-php-ext-install opcache
RUN docker-php-ext-install intl
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install pdo_mysql

EXPOSE 9000

Errors on docker build:

/usr/src/php/ext/memcached/php_memcached.c: In function 'zim_Memcached___construct':
/usr/src/php/ext/memcached/php_memcached.c:1278:20: error: lvalue required as left operand of assignment
   GC_REFCOUNT(&le) = 1;
                    ^
/usr/src/php/ext/memcached/php_memcached.c: In function 'php_memc_register_constants':
/usr/src/php/ext/memcached/php_memcached.c:4187:50: error: 'MEMCACHED_BEHAVIOR_CLIENT_MODE' undeclared (first use in this function)
  REGISTER_MEMC_CLASS_CONST_LONG(OPT_CLIENT_MODE, MEMCACHED_BEHAVIOR_CLIENT_MODE);
                                                  ^
/usr/src/php/ext/memcached/php_memcached.c:4127:131: note: in definition of macro 'REGISTER_MEMC_CLASS_CONST_LONG'
  #define REGISTER_MEMC_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(php_memc_get_ce() , ZEND_STRS( #name ) - 1, value)
                                                                                                                                   ^~~~~
/usr/src/php/ext/memcached/php_memcached.c:4187:50: note: each undeclared identifier is reported only once for each function it appears in
  REGISTER_MEMC_CLASS_CONST_LONG(OPT_CLIENT_MODE, MEMCACHED_BEHAVIOR_CLIENT_MODE);
                                                  ^
/usr/src/php/ext/memcached/php_memcached.c:4127:131: note: in definition of macro 'REGISTER_MEMC_CLASS_CONST_LONG'
  #define REGISTER_MEMC_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(php_memc_get_ce() , ZEND_STRS( #name ) - 1, value)
                                                                                                                                   ^~~~~
/usr/src/php/ext/memcached/php_memcached.c:4188:68: error: 'MEMCACHED_BEHAVIOR_DYNAMIC_POLLING_THRESHOLD_SECS' undeclared (first use in this function)
  REGISTER_MEMC_CLASS_CONST_LONG(OPT_DYNAMIC_POLLING_INTERVAL_SECS, MEMCACHED_BEHAVIOR_DYNAMIC_POLLING_THRESHOLD_SECS);
                                                                    ^
/usr/src/php/ext/memcached/php_memcached.c:4127:131: note: in definition of macro 'REGISTER_MEMC_CLASS_CONST_LONG'
  #define REGISTER_MEMC_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(php_memc_get_ce() , ZEND_STRS( #name ) - 1, value)
                                                                                                                                   ^~~~~
/usr/src/php/ext/memcached/php_memcached.c:4272:65: error: 'MEMCACHED_NO_CONFIG_SERVER' undeclared (first use in this function)
  REGISTER_MEMC_CLASS_CONST_LONG(RES_MEMCACHED_NO_CONFIG_SERVER, MEMCACHED_NO_CONFIG_SERVER);
                                                                 ^
/usr/src/php/ext/memcached/php_memcached.c:4127:131: note: in definition of macro 'REGISTER_MEMC_CLASS_CONST_LONG'
  #define REGISTER_MEMC_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(php_memc_get_ce() , ZEND_STRS( #name ) - 1, value)
                                                                                                                                   ^~~~~
/usr/src/php/ext/memcached/php_memcached.c:4293:53: error: 'STATIC_MODE' undeclared (first use in this function)
  REGISTER_MEMC_CLASS_CONST_LONG(STATIC_CLIENT_MODE, STATIC_MODE);
                                                     ^
/usr/src/php/ext/memcached/php_memcached.c:4127:131: note: in definition of macro 'REGISTER_MEMC_CLASS_CONST_LONG'
  #define REGISTER_MEMC_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(php_memc_get_ce() , ZEND_STRS( #name ) - 1, value)
                                                                                                                                   ^~~~~
/usr/src/php/ext/memcached/php_memcached.c:4294:54: error: 'DYNAMIC_MODE' undeclared (first use in this function)
  REGISTER_MEMC_CLASS_CONST_LONG(DYNAMIC_CLIENT_MODE, DYNAMIC_MODE);
                                                      ^
/usr/src/php/ext/memcached/php_memcached.c:4127:131: note: in definition of macro 'REGISTER_MEMC_CLASS_CONST_LONG'
  #define REGISTER_MEMC_CLASS_CONST_LONG(name, value) zend_declare_class_constant_long(php_memc_get_ce() , ZEND_STRS( #name ) - 1, value)
                                                                                                                                   ^~~~~
Makefile:194: recipe for target 'php_memcached.lo' failed
make: *** [php_memcached.lo] Error 1
The command '/bin/sh -c curl -L -o /tmp/memcached.tar.gz "https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php/archive/php7.tar.gz"   && mkdir -p /usr/src/php/ext/memcached   && tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1   && docker-php-ext-configure memcached   && docker-php-ext-install memcached   && rm /tmp/memcached.tar.gz' returned a non-zero code: 2

Any guidance on a fix would be appreciated, thanks in advance.

elyobo commented 5 years ago

Given the still outstanding lack of support for 7.2 I wouldn't hold my breath.

n10000k commented 5 years ago

Given the still outstanding lack of support for 7.2 I wouldn't hold my breath.

One could only hope. Looks like Redis is the only option as AWS don't want to keep this repo up to date.

mclueppers commented 5 years ago

One can easily conclude that this project is dead considering the time of the last commit. I switched to Redis long time ago.

Bit-Doctor commented 5 years ago

I did the same today, switched to ubuntu 18.04, php7.2 and redis.

antydemant commented 5 years ago

Bump up ✋ Do you have any updates about development for PHP 7.3 support?

comalle23 commented 5 years ago

I opened an aws support case asking about this - while (as always) they didn't commit to anything, hopefully it bumped up the priority on whoever's responsible for this over there nowadays 🤷‍♂

n10000k commented 5 years ago

@comalle23 Did AWS get back to your support ticket?

comalle23 commented 5 years ago

@comalle23 Did AWS get back to your support ticket? they did before i posted - said they couldn't commit yada yada but they'd maybe ping whoever is responsible for it and maybe they'd do something about it someday, etc. still haven't last time i checked. 🤷‍♂

theoc31 commented 5 years ago

So I've managed to build this on CentOS 7 for PHP 7.3 using 7.1 instructions from here (thanks @pabdavis & @jpriebe ) : https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php/issues/11#issuecomment-301193228

This used lib-memcached 1.0.8 as many mention lots of building errors with latest.

Changing the instructions above to use remi-php73 and then modifying 2 files before running final make command:

/tmp/aws-elasticache-cluster-client-memcached-for-php/php_memcached.c (Line 1278) Change GC_REFCOUNT(&le) = 1; to GC_SET_REFCOUNT(&le, 1);

and Line 3651 Change GC_REFCOUNT(fci.object)++; to GC_ADDREF(fci.object);

/tmp/aws-elasticache-cluster-client-memcached-for-php/php_memcached_session.c (Line 379) Change GC_REFCOUNT(&le) = 1; to GC_SET_REFCOUNT(&le, 1);

The above changes reflect changes in the Zend API.

For the lazy people: http://www.filedropper.com/amazon-elasticache-cluster-clientphp73

antydemant commented 5 years ago

@theoc31 Thank you for your tip! Also, be aware if you are using DISTRIBUTION_CONSISTENT option, it has different behavior with lib-memcached 1.0.8. This option not backward compatible with legacy lib-memcached 1.0.8 and lib-memcached 1.0.18. For more information: https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php/issues/28

theoc31 commented 5 years ago

@theoc31 Thank you for your tip! Also, be aware if you are using DISTRIBUTION_CONSISTENT option, it has different behavior with lib-memcached 1.0.8. This option not backward compatible with legacy lib-memcached 1.0.8 and lib-memcached 1.0.18. For more information: #28

Thanks for that @antydemant. I've now successfully also recompiled the client with lib-memcached 1.0.18. Not sure why it initially failed but got it working on a clean box. That should hopefully allow people like me to move to php 7.3 with elasticache. 😄

Here it is for anyone who needs it: https://mega.nz/#!niwSkCxT!YcPNcaMhfn8gLDIdCCeux4GNbH2LlSyjxDmzaimw5LQ

chregu commented 5 years ago

Here's a patched fork for php-7.3 support https://github.com/liip-forks/aws-elasticache-cluster-client-memcached-for-php It just applied the 3 lines mentioned at https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php/issues/27#issuecomment-517274378

Maybe it helps someone

sodabrew commented 5 years ago

I'm an upstream maintainer at https://github.com/php-memcached-dev/php-memcached. As I mentioned in #29, I really want to see the AWS folks sync with upstream. It's a positive multiplier effect because it means everyone bumps into the same gotcha & bugs and can get them fixed for everyone over time.

I don't have any personal contacts with the AWS folks who would be working on this, however. Thanks for posting/sharing your efforts!

yulazari commented 5 years ago

Merged the upstream from https://github.com/php-memcached-dev/php-memcached. php-7.3 is now supported.