Score:1

How do I install php-memcached for php 8.x on Amazon Linux 2 aarch64?

gb flag

I'm migrating our website from an older Centos server to a new EC2 instance (Amazon Linux 2, aarch64). I'd like to install both the LAMP stack and memcached on the EC2 instance stack; which is the setup we had on our old server

The amzn2extra-php7.4 repo has a package php-pecl-memcached.aarch64, but there is no corresponding package for either amzn2extra-php8.0 or amzn2extra-php8.1

All the guides I have found online are for PHP 7.4 and seem to make use of php-pecl-memcached, and I'd rather not downgrade to a PHP version that is no longer supported

I did find some documentation on how to install the Amazon Elasticache extension, which supports memcached, but that appears to be designed only to connect with a separate managed cluster, and I want to install memcached on the same machine

Is there a workaround?

Score:1
ru flag

Since the memcached extension is not available in the Amazon repositories, you'll have to install it from PECL with the procedure below.

Enable Amazon channels:

sudo amazon-linux-extras enable php8.1 memcached1.5
sudo yum update

Install build tools and dependencies:

sudo yum install -y gcc make php php-pear php-devel libmemcached libmemcached-devel zlib-devel memcached

Install the memcached extension from PECL:

sudo pecl update-channels
sudo pecl install memcached

Follow the prompts and instructions on screen (press Enter to use default options).

Activate the extension:

echo extension=memcached.so | sudo tee -a /etc/php.ini
sudo systemctl restart httpd

Now confirm that the extension is loaded

php --info | grep "memcached support"

Please note that all this gives you is an unsupported memcached extension and you are in charge of installing security updates for it from now on.

In a production environment I would strongly prefer the Ubuntu image instead, where apt install php8.1-memcached memcached installs the same thing and it gets automatic security updates.

Arth avatar
gb flag
Thanks, beat me to it - I ended up doing something similar, it's a shame that the amazon repos are missing this stuff
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.