Skip to content

Missing support for php 7.2 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gergnz opened this issue Mar 21, 2018 · 32 comments
Closed

Missing support for php 7.2 #19

gergnz opened this issue Mar 21, 2018 · 32 comments

Comments

@gergnz
Copy link

gergnz commented Mar 21, 2018

I'm not able to use the php7 branch to build against php7.2. While the build completes, the shared object can't be loaded due to a missing symbol, which looks to have changed between php 7.1 and php 7.2: strpprintf

@sodabrew
Copy link
Contributor

See #11 for instructions on how to compile – Both PHP 7.1 and 7.2 are supported by the underlying modules, however binaries are provided by Amazon only for PHP 7.0 at this time.

@gergnz
Copy link
Author

gergnz commented Mar 21, 2018

I've tried and it's not working. (see my comments re missing symbol strpprintf). It looks like this has changed in zend, and my C isn't good enough to understand what's going on.

Also this comment (#11 (comment)) suggests that it isn't working for others.

@QuChen88
Copy link
Contributor

I just managed to install PHP 7.2 on ubuntu 16.04 and compile the client based on libmemcached 1.0.8. In case you need the binary to get unblocked, here it is. Let me know if this works for you or not.

AmazonElasticacheClusterClient-PHP72-64bit-libmemcached-1.0.8.tar.gz

@markhughes
Copy link

@QuChen88 tested on PHP Version 7.2.5-1+ubuntu16.04.1 and it seems to be connecting and doing basics. Will have a better play later.

@agaleski
Copy link

On PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 via ppa:ondrej/php copy the amazon-elasticache-cluster-client.so from @QuChen88 (#19 (comment)) to /usr/lib/php/20170718/ so php7.2-fpm can find it

@elyobo
Copy link

elyobo commented Oct 11, 2018

Part way through upgrading to PHP 7.2 on Amazon Linux and 💣 💥 turns out that AWS doesn't provide a client yet :-/

@elyobo
Copy link

elyobo commented Oct 11, 2018

That said, @QuChen88's version above does seem to work for me on the latest Amazon Linux; any news when an "official" version would be available?

@elyobo
Copy link

elyobo commented Oct 16, 2018

Addendum, we're seeing a lot of logs with Unknown: using touch command with binary protocol is not recommended with libmemcached versions below 1.0.18, please use ascii protocol or upgrade libmemcached with @QuChen88's package above. @QuChen88, given the comments on php-memcached-dev/php-memcached#310 and php-memcached-dev/php-memcached#322 it seems like compiling against a newer libmemcached is probably required to support the default PHP7 behaviour (lazy write enabled).

@putchi
Copy link

putchi commented Nov 8, 2018

I just managed to install PHP 7.2 on ubuntu 16.04 and compile the client based on libmemcached 1.0.8. In case you need the binary to get unblocked, here it is. Let me know if this works for you or not.

AmazonElasticacheClusterClient-PHP72-64bit-libmemcached-1.0.8.tar.gz

This worked for me.
OS: ubuntu 18 latest

  • php info:
    PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

@gergnz you should close this issue for the best answer of @QuChen88

@powrsurg
Copy link

powrsurg commented Nov 8, 2018

I would say this should be verified on systems besides Ubuntu before closing.

@sodabrew
Copy link
Contributor

sodabrew commented Nov 8, 2018 via email

@gergnz
Copy link
Author

gergnz commented Nov 11, 2018

@sodabrew, can you advise on these upstream changes please?

@sodabrew
Copy link
Contributor

Read five comments back, the error message says to use an updated library to avoid a specific bug. That text is meant to be as clear as possible in people’s error logs.

@mosesliao
Copy link

is there an aws elastic client memcached for PHP 7.2 in amazon linux?

@putchi
Copy link

putchi commented Dec 3, 2018

is there an aws elastic client memcached for PHP 7.2 in amazon linux?
Read my comment above. @QuChen88 comment worked for me.

@elyobo
Copy link

elyobo commented Dec 3, 2018

It "works" for certain values of "works"; the stream of warnings reporting about Unknown: using touch command with binary protocol is not recommended with libmemcached versions below 1.0.18, please use ascii protocol or upgrade libmemcached is concerning and @sodabrew's (maintainer of the upstream php-memcached) comments also suggest that this issue is not properly resolved.

To resolve this

  • update libmemcached
  • do a proper release with it, not just a comment in an issue
  • have it downloadable through the AWS console as per other releases

@mosesliao
Copy link

is there an aws elastic client memcached for PHP 7.2 in amazon linux?
Read my comment above. @QuChen88 comment worked for me.

@QuChen88 answer is for debian OS. what about amazon linux?

@elyobo
Copy link

elyobo commented Dec 4, 2018

My comments above are from using it on Amazon Linux @liaogz82; it installs and appears to work, but has a stream of warnings in the logs and the impact of that isn't clear to me.

@mosesliao
Copy link

@elyobo how do you get the logs? I managed to get it working and on the surface seems to be ok

@elyobo
Copy link

elyobo commented Dec 5, 2018

Wherever your PHP logs go, and presumably also dependent on your error_reporting settings.

@Seegras
Copy link

Seegras commented Dec 11, 2018

I just managed to install PHP 7.2 on ubuntu 16.04 and compile the client based on libmemcached 1.0.8. In case you need the binary to get unblocked, here it is. Let me know if this works for you or not.

How did you manage to compile it? Where's the source-tree with the modifications you needed to make, and where are the compile parameters documented? Thank you.

@luishdz1010
Copy link

Here's a Dockerfile for compiling on 7.2

FROM centos:7

RUN yum -y install epel-release
RUN yum -y update
RUN yum install -y wget git
RUN wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN rpm -Uvh remi-release-7.rpm
RUN yum-config-manager --enable remi-php72
RUN yum update

RUN yum install -y php php-cli gcc gcc-c++ autoconf libevent-devel php-devel zlib-devel make

RUN mkdir /tmp/libmemcached \
    && cd /tmp/libmemcached \
    && git clone https://github.com/awslabs/aws-elasticache-cluster-client-libmemcached.git

RUN cd /tmp/libmemcached/aws-elasticache-cluster-client-libmemcached \
    && touch configure.ac aclocal.m4 configure Makefile.am Makefile.in \
    && mkdir BUILD

WORKDIR /tmp/libmemcached/aws-elasticache-cluster-client-libmemcached/build

RUN ../configure --prefix=/tmp/libmemcached --with-pic
RUN make
RUN make install

WORKDIR /usr/lib64
RUN ln libsasl2.so.3 libsasl2.so.2
RUN ln libsasl2.so.3 libsasl2.so

RUN cd /tmp \
    && git clone https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php.git \
    && cd aws-elasticache-cluster-client-memcached-for-php/ \
    && git checkout php7

WORKDIR /tmp/aws-elasticache-cluster-client-memcached-for-php/

RUN phpize
RUN ./configure --with-libmemcached-dir=/tmp/libmemcached --disable-memcached-sasl
RUN sed -i "s#-lmemcached#/tmp/libmemcached/lib/libmemcachedutil.a /tmp/libmemcached/lib/libmemcached.a -lcrypt -lpthread -lm -lstdc++ -lsasl2#" Makefile
RUN sed -i "s#-lmemcachedutil##" Makefile
RUN sed -i "s#-L/tmp/libmemcached/lib##" Makefile
RUN make

@QuChen88
Copy link
Contributor

@Seegras IIRC, I compiled it following the instructions I had in the README.markdown file. I launched an EC2 instance from AWS console using the standard Ubuntu AMI.

@WillyYeh
Copy link

WillyYeh commented Jan 17, 2019

Many thanks to @luishdz1010. I followed your Dockerfile and build my own RPM and PEAR package.
Follow these steps to build our own RPMS and PEAR package.

  • Prepare the building environment.
    Create a development environment which are same as production environment. For example, m5.medium in EC2. And limit the max hosts to 1 if your are using Elastic Beanstalk.
export HOME=/home/ec2-user
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
sudo yum -y install rpm-build java-1.8.0-openjdk
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
echo "%packager You <your@email>" >> ~/.rpmmacros
mkdir ~/src
  • Build libmemcached RPM
    Create your own libmemcached.spec before running below commands.
cd ~/src
sudo yum install -y libevent-devel
wget https://github.com/awslabs/aws-elasticache-cluster-client-libmemcached/archive/v1.0.18.tar.gz
tar zxf v1.0.18.tar.gz
cd aws-elasticache-cluster-client-libmemcached-1.0.18 && mkdir BUILD && cd BUILD
../configure --prefix=/usr --libdir=/usr/lib64 --with-pic && make && make DESTDIR=/home/ec2-user/rpmbuild/SOURCES/libmemcached-1.0.18 install
cd ~/rpmbuild/SOURCES
rm libmemcached-1.0.18/usr/lib64/*.la
tar zcf libmemcached-1.0.18.tar.gz libmemcached-1.0.18
sed -i '/^%defattr/,$d' ../SPECS/libmemcached.spec && echo -e "%defattr(-,root,root,-)" >> ../SPECS/libmemcached.spec && find libmemcached-1.0.18 ! -type d ! \( -path 'libmemcached-1.0.18/usr/include/*' -o -path 'libmemcached-1.0.18/usr/lib64/pkgconfig/*' -o -path 'libmemcached-1.0.18/usr/share/man/man3/*' -o -path 'libmemcached-1.0.18/usr/share/aclocal/*' -o -path 'libmemcached-1.0.18/usr/lib64/*' \) -o -path 'libmemcached-1.0.18/usr/lib64/*.so.*' -o -path 'libmemcached-1.0.18/usr/lib64/*.a' | sed 's/^[^\/]*\//\//g' >> ../SPECS/libmemcached.spec && echo -e "\n%files devel\n%defattr(-,root,root,-)" >> ../SPECS/libmemcached.spec && find libmemcached-1.0.18 ! -type d \( -path 'libmemcached-1.0.18/usr/include/*' -o -path 'libmemcached-1.0.18/usr/lib64/pkgconfig/*' -o -path 'libmemcached-1.0.18/usr/share/man/man3/*' -o -path 'libmemcached-1.0.18/usr/share/aclocal/*' -o -path 'libmemcached-1.0.18/usr/lib64/*.so' \) | sed 's/^[^\/]*\//\//g' >> ../SPECS/libmemcached.spec
vi ../SPECS/libmemcached.spec
rm -rf libmemcached-1.0.18
rpmbuild -bb ../SPECS/libmemcached.spec
sudo rpm -Uvh ../RPMS/x86_64/libmemcached-1.0.18-1.amzn1.x86_64.rpm ../RPMS/x86_64/libmemcached-devel-1.0.18-1.amzn1.x86_64.rpm
  • Build ElastiCache Cluster Client for PHP PEAR package.
    Download AmazonElastiCacheClusterClient-1.0.0-PHP70-64bit.tgz from AWS ElastiCache Client for PHP webpage. Untar it and then change folder name to AmazonElastiCacheClusterClient-2.0.3 if you like. Remember you have to update the md5 of modules/memcached.so in package.xml.
cd ~/src
sudo yum install -y cyrus-sasl-devel php72-pecl-igbinary-devel
git clone https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php.git && cd aws-elasticache-cluster-client-memcached-for-php/ && git checkout php7
phpize
./configure --disable-memcached-sasl --enable-memcached-igbinary --with-libmemcached-dir=/usr && make
tar zxf <somewhere>/AmazonElastiCacheClusterClient-2.0.3-PHP72-64bit.tgz
cp modules/memcached.so AmazonElastiCacheClusterClient-2.0.3/amazon-elasticache-cluster-client.so
vi package.xml
rm AmazonElastiCacheClusterClient-2.0.3-PHP72-64bit.tgz && tar zcf AmazonElastiCacheClusterClient-2.0.3-PHP72-64bit.tgz package.xml AmazonElastiCacheClusterClient-2.0.3/

Now you can install by pecl7 install AmazonElastiCacheClusterClient-2.0.3-PHP72-64bit.tgz
PS: You may get an error which related to /usr/share/pear7/Archive/Tar.php
Just run below command:
sed -i '639s/$v_att_list = & func_get_args();/\\$v_att_list \\&= func_get_args();/' /usr/share/pear7/Archive/Tar.php

@jswinborne
Copy link

jswinborne commented Jan 21, 2019

We are moving to Ubuntu 18.04, and I was surprised to see the version for PHP 7.2 not downloadable directly from AWS yet. Considering PHP 7.2 was released over 1 year ago, and is the standard in Ubuntu's newest LTS, I am hoping it is coming soon. Are there plans to make this available for download, or provide instructions for compiling in 18.04? I have tried several different ways of compiling in 18.04 and I haven't had much success yet.

@ninjada
Copy link

ninjada commented Feb 12, 2019

Second jswinborne's comments. Been waiting for what seems like forever for this -- compilings not the end of the world but have had it cause a couple of hiccups with my moves to Amazon Linux 2.

I would have thought the amazon-linux-extras option would have been perfect for this? Given its intended ease of use is somewhat logically questionable in the first place.

@elyobo elyobo mentioned this issue Feb 18, 2019
@elyobo
Copy link

elyobo commented Feb 18, 2019

@QuChen88 is this project officially supported by AWS? It's in the awslabs account and you're a member of the Amazon Web Services org, so I've been assuming so, but given the lack of any activity in supporting the PHP versions available on AWS's own "Amazon Linux" distro I may have misunderstood?

@nkhine
Copy link

nkhine commented Apr 19, 2019

i managed to get it working under docker https://github.com/nkhine/centos-nginx-php72-fpm/blob/master/Dockerfile

you can download the client for 7.2 from https://eu-west-1.console.aws.amazon.com/elasticache/home?region=eu-west-1#client-download:

AWS Support just sent this:

Coming back to your question with related to the PHP client version, Amazon officially provides the Elasticache Memcached Cluster Client PHP 7.0 and 7.2 now. The client version is available to download from the ElastiCache console under the section ElastiCache cluster clients. Unfortunately, I do noticed that the repo link provided do not get properly and apologize for the confusion it has been caused to you.

Could you please check and update the client version to 7.2 to match your current PHP version. Once you have downloaded the required client version, please install the latest version of the ElastiCache PHP client. Please note that to update the php-memcached installation you need to remove the previous installation of the Memcached extension for PHP and install the new ElastiCache php-memcached extension as described here [2-3].

If you need any further assistance, please don't hesitate to reply to this case, I will be happy to assist you.

Reference:

[1] Installing the ElastiCache Cluster Client for PHP - https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/Appendix.PHPAutoDiscoverySetup.html
[2] Removing the PHP Cluster Client - https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/Appendix.PHPAutoDiscoverySetup.Removing.html
[3] Installation Steps for New Users - https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/Appendix.PHPAutoDiscoverySetup.Installing.html

@QuChen88
Copy link
Contributor

QuChen88 commented Sep 3, 2019

PHP 7.2 is now supported and downloadable from AWS console.

@QuChen88 QuChen88 closed this as completed Sep 3, 2019
@bensebborn
Copy link

@QuChen88 is this 7.2 .so file compiled against libmemcached 1.0.8 or 1.0.18?

@yzhaon
Copy link

yzhaon commented Apr 23, 2020

@QuChen88 is this 7.2 .so file compiled against libmemcached 1.0.8 or 1.0.18?

The PHP 7.2 memcached client is now compiled against libmemcached 1.0.18.

Please update if you had an older version.

@rmanidev
Copy link

rmanidev commented Feb 18, 2022

I have downloaded the latest version, libmemcached 1.0.18 . I have an issue on this after resetserverlist() the Memcached object is not supported properly. Anybody known this error?
Sample Code is :
`$m = new \Memcached($persistent_id);

$m->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);

var_dump($m->addServer($host, $port, $weight));
echo "
server List: ";var_dump($m->getServerList());
echo "
Reset Server Status: ";var_dump($m->resetServerList());
echo "
Add Server Status: ";var_dump($m->addServer($host, $port, $weight));
echo "
Server List: ";var_dump($m->getServerList());`

Result is:
Reset Server Status: bool(true)
Add Server Status: bool(false)
Server List: array(0) { }

After resetServerList() function is not working properly. But the same code is working correctly in php Memcached library.

Please update anyone know this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests