Skip to content

Commit c57880a

Browse files
authored
Fix Redis and Memcached drivers installation errors
1 parent 51e226f commit c57880a

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

templates/04-web.yaml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,22 @@ Resources:
456456
pecl install -f libsodium
457457
echo "extension=sodium.so;" > /etc/php.d/50-sodium.ini
458458
459+
# Install Redis client as well as related extensions - see here https://github.com/amazonlinux/amazon-linux-2023/issues/328
460+
pear update-channels
461+
pecl update-channels
462+
/usr/bin/yes 'no' | pecl install igbinary
463+
echo 'extension=igbinary.so' > /etc/php.d/30-igbinary.ini
464+
/usr/bin/yes 'no' | pecl install msgpack
465+
echo 'extension=msgpack.so' > /etc/php.d/30-msgpack.ini
466+
dnf install -q -y libzstd-devel
467+
/usr/bin/yes 'no' | pecl install zstd
468+
echo 'extension=zstd.so' > /etc/php.d/40-zstd.ini
469+
/usr/bin/yes 'no' | pecl install --configureoptions 'enable-lzf-better-compression="no"' lzf
470+
echo 'extension=lzf.so' > /etc/php.d/40-lzf.ini
471+
dnf install -q -y redis6-devel lz4-devel
472+
/usr/bin/yes 'no' | pecl install --configureoptions 'enable-redis-igbinary="yes" enable-redis-lzf="yes" enable-redis-zstd="yes" enable-redis-msgpack="yes" enable-redis-lz4="yes" with-liblz4="yes"' redis
473+
echo 'extension=redis.so' > /etc/php.d/41-redis.ini
474+
459475
# Adjust base php.ini
460476
sed -i 's/memory_limit =.*/memory_limit = 4096M/' /etc/php.ini
461477
sed -i 's/;max_input_vars.*/max_input_vars = 5000/' /etc/php.ini
@@ -484,21 +500,24 @@ Resources:
484500
sed -i 's/;opcache.use_cwd=.*/opcache.use_cwd=1/' /etc/php.d/10-opcache.ini
485501
sed -i 's/;opcache.validate_timestamps=.*/opcache.validate_timestamps=1/' /etc/php.d/10-opcache.ini
486502
sed -i 's/;opcache.save_comments=.*/opcache.save_comments=1/' /etc/php.d/10-opcache.ini
487-
sed -i 's/;opcache.enable_file_override=.*/opcache.enable_file_override=60/' /etc/php.d/10-opcache.ini
488503
sed -i 's/;opcache.file_cache_only=.*/opcache.file_cache_only=1/' /etc/php.d/10-opcache.ini
489504
490505
# Install ElastiCache client
491-
if [ $(uname -a | grep -c x86_64) == "1" ]; then
492-
echo "downloading x86 client for ElastiCache"
493-
wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.1/latest-64bit-X86-openssl3
494-
tar -xf '/tmp/latest-64bit-X86-openssl3'
495-
else
496-
echo "downloading ARM-64 client for ElastiCache"
497-
wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.2/latest-64bit-arm-X86-openssl3
498-
tar -xf '/tmp/latest-64bit-arm-X86-openssl3'
499-
fi
500-
mv amazon-elasticache-cluster-client.so /usr/lib64/php/modules/
501-
echo 'extension=amazon-elasticache-cluster-client.so;' > /etc/php.d/50-elasticache.ini
506+
#if [ $(uname -a | grep -c x86_64) == "1" ]; then
507+
# echo "downloading x86 client for ElastiCache"
508+
# wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.1/latest-64bit-X86-openssl3
509+
# tar -xf '/tmp/latest-64bit-X86-openssl3'
510+
#else
511+
# echo "downloading ARM-64 client for ElastiCache"
512+
# wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.2/latest-64bit-arm-X86-openssl3
513+
# tar -xf '/tmp/latest-64bit-arm-X86-openssl3'
514+
#fi
515+
#mv amazon-elasticache-cluster-client.so /usr/lib64/php/modules/
516+
#echo 'extension=amazon-elasticache-cluster-client.so;' > /etc/php.d/50-elasticache.ini
517+
# Install Memcached client - note that ElastiCache client is failing on AL2023
518+
dnf install libmemcached libmemcached-devel -y -q
519+
/usr/bin/yes 'no' | pecl install memcached
520+
echo 'extension=memcached.so' > /etc/php.d/41-memcached.ini
502521
503522
# Mount EFS
504523
availabilityzone=$(ec2-metadata -z | awk '{print $2}' | sed 's/(.)//')

0 commit comments

Comments
 (0)