Skip to content
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

[Package Request] - php-pecl-memcached #208

Open
sunaoka opened this issue Oct 13, 2022 · 8 comments
Open

[Package Request] - php-pecl-memcached #208

sunaoka opened this issue Oct 13, 2022 · 8 comments
Labels
enhancement New feature or request epel Package request for one that was in EPEL packages Package request

Comments

@sunaoka
Copy link

sunaoka commented Oct 13, 2022

What package is missing from Amazon Linux 2023? Please describe and include package name.

php-pecl-memcached, php-pecl-igbinary

Is this an update to existing package or new package request?

New package request.

Is this package available in Amazon Linux 2?

Yes.

Number of users impacted

More than 1 million users we serve.

@stewartsmith stewartsmith added the enhancement New feature or request label Nov 4, 2022
@jocel1
Copy link

jocel1 commented Aug 10, 2023

at least libmemcached package should be available to be able to easily install memcached through
pecl install memcached

@ozbenh
Copy link

ozbenh commented Aug 14, 2023

We are investigating adding libmemcached-awesome (so you get the library at least) in a future release. We don't currently have plans to ship pecl packages, but this should enable pecl install of it hopefully

@gregnetau
Copy link

gregnetau commented Aug 28, 2023

FYI this is what it took me to get it working in an .ebextension

    command: |
      if [[ $(php -m | grep memcached | wc -l) -eq "0" ]]; then
        cd /tmp
        wget <your S3 URL>/libmemcached-1.1.4.rpm -O /tmp/libmemcached.rpm
        rpm -ihv /tmp/libmemcached.rpm
        pecl install  --onlyreqdeps --nobuild memcached
        cd "$(pecl config-get temp_dir)/redis"
        phpize
        ./configure --disable-memcached-sasl
        sudo make 
        sudo make install
      else
        echo "memcached allready loaded."
      fi

@jocel1
Copy link

jocel1 commented Aug 28, 2023

hi @gregnetau, you can also use --configureoptions if you want to avoid phpize / configure / make lines :

e.g.:

pecl install --configureoptions 'with-libmemcached-dir="no" with-zlib-dir="no" with-system-fastlz="no" enable-memcached-igbinary="yes" enable-memcached-msgpack="no" enable-memcached-json="no" enable-memcached-protocol="no" enable-memcached-sasl="no" enable-memcached-session="no"' memcached

@ajsultandev
Copy link

hi @jocel1, I tried your command but its still failing due to requiring the libmemcached directory

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: `/var/tmp/memcached/configure --with-php-config=/usr/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=no --with-system-fastlz=no --enable-memcached-igbinary=yes --enable-memcached-msgpack=no --enable-memcached-json=no --enable-memcached-protocol=no --enable-memcached-sasl=no --enable-memcached-session=no' failed

The library needs to get added at least for us to build it using pecl.

@stewartsmith stewartsmith added the packages Package request label Sep 20, 2023
@limmike
Copy link

limmike commented Sep 22, 2023

libmemcached-awesome is available in version 2023.2.20230920.
This is how I install it in my LAMP stack CloudFormation UserData.

dnf install -q -y php-devel php-pear gcc
pear update-channels
pecl update-channels

/usr/bin/yes 'no' | pecl install igbinary
echo 'extension=igbinary.so' > /etc/php.d/30-igbinary.ini

/usr/bin/yes 'no' | pecl install msgpack
echo 'extension=msgpack.so' > /etc/php.d/30-msgpack.ini

dnf install -q -y memcached-devel libmemcached-awesome-devel zlib-devel cyrus-sasl-devel libevent-devel
/usr/bin/yes 'no' | pecl install --configureoptions 'enable-memcached-igbinary="yes" enable-memcached-msgpack="yes" enable-memcached-json="yes" enable-memcached-protocol="yes" enable-memcached-sasl="yes" enable-memcached-session="yes"' memcached
echo 'extension=memcached.so' > /etc/php.d/41-memcached.ini

Run the above commands as root

Edit: include igbinary and msgpack

@cbanack
Copy link

cbanack commented Sep 22, 2023

To build on limmike's answer, you also need to install igbinary and msgpack.

My Dockerfile starts with the following:

FROM public.ecr.aws/amazonlinux/amazonlinux:2023.2.20230920.1
# in a few days/weeks, the latest 2023 from docker hub should work fine too:
#FROM amazonlinux:2023

and further down:

# NOTE: Amazon Linux 2023 doesn't include any external php extensions, so
# we have to download and build them ourselves with pear, pecl and gcc:
RUN  dnf -y install php8.2-devel php-pear gcc && \
   pear update channels && \
   pecl update channels && \
   \
   # build + install igbinary for use by php-memcached
   pecl install igbinary && \
   echo "extension=igbinary.so" | sudo tee /etc/php.d/20-igbinary.ini && \
   \
   # build + install msgpack for use by php-memcached
   pecl install msgpack && \
   echo "extension=msgpack.so" | sudo tee /etc/php.d/20-msgpack.ini && \
   \
   # build + install php-memcached
   dnf install -q -y memcached-devel memcached \
       libmemcached-awesome-devel libmemcached-awesome \
       zlib-devel zlib cyrus-sasl cyrus-sasl-devel \
       libevent libevent-devel && \
   pecl install --configureoptions \
      'with-zlib-dir="no" \
       with-system-fastlz="no" \
       with-libmemcached-dir="no" \
       enable-memcached-igbinary="yes" \
       enable-memcached-msgpack="yes" \
       enable-memcached-json="yes" \
       enable-memcached-protocol="yes" \
       enable-memcached-sasl="yes" \
       enable-memcached-session="yes"' memcached &&  \
   echo "extension=memcached.so" | sudo tee /etc/php.d/25-memcached.ini && \
   \
   # clean up php dev tools and the dnf cache
   dnf remove -y gcc php8.2-devel php-pear libzip-devel \
      memcached-devel libmemcached-awesome-devel zlib-devel \
      cyrus-sasl-devel libevent-devel && \
   dnf autoremove -y && dnf clean all && rm -rf /var/cache/dnf

Then when I run phpinfo(), on this image, I get a working php-memcached module:

image

@ajsultandev
Copy link

Confirming that after updating to version 2023.2.20230920 I can now build and install memcached using pecl!

Both instructions from limmike and cbanack works just fine, just make sure you are in the newest version of al2023 mentioned above.

@stewartsmith stewartsmith added the epel Package request for one that was in EPEL label Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epel Package request for one that was in EPEL packages Package request
Projects
None yet
Development

No branches or pull requests

8 participants