类'Memcached'在 Laravel Elastic Beanstalk 应用程序中找不到



我正在将laravel 6项目部署到amazon弹性豆茎应用程序中。它正在运行php7.3。

eb deploy

错误:ServiceError-无法部署应用程序。

查看日志,我发现它找不到类"Memcached">

@php artisan包:发现--ansi

SymfonyComponentDebugExceptionFatalThrowableError  : Class 'Memcached' not found
at /var/app/ondeck/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:69
65|      * @return Memcached
66|      */
67|     protected function createMemcachedInstance($connectionId)
68|     {
> 69|         return empty($connectionId) ? new Memcached : new Memcached($connectionId);
70|     }
71| 
72|     /**
73|      * Set the SASL credentials on the Memcached connection.
Exception trace:
1   IlluminateCacheMemcachedConnector::createMemcachedInstance()
/var/app/ondeck/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:48
2   IlluminateCacheMemcachedConnector::getMemcached([], [])
/var/app/ondeck/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:21

这些实例运行的是AmazonLinux2.9。

我还添加了一个配置文件来使用这些包安装memcache。是.ebextensions/memcache_installer.cfg.yml具有以下内容:

packages: 
yum:
memcached: [] 
php-pecl-memcached: []

这个错误仍然没有消失。然而,它们确实被安装了,因为如果我试图从实例中安装它们,我会得到已经安装的包。

我们解决了它(至少在我们的回购中(。删除php-pecl-memchached,因为amazon yum版本将php5作为依赖项(我们在错误日志中看到了这一点(。

我们在.ebextensions:中添加了什么

memcached.config:

packages: 
yum:
memcached: []
container_commands:
01_memcached_start:
command: "/sbin/service memcached restart"

elasticache_01.config

files:
"/tmp/AmazonElastiCacheClusterClient-2.0.1-PHP73.tar.gz" :
mode: "000777"
owner: ec2-user
group: ec2-user
source: http://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-7.3/latest-64bit

elasticache_02.config:

commands:
01unzip:
command: "tar -zxvf /tmp/AmazonElastiCacheClusterClient-2.0.1-PHP73.tar.gz -C /usr/lib64/php/7.3/modules"
files:
/etc/php.d/project.ini:
content: |
extension=amazon-elasticache-cluster-client.so
group: ec2-user
mode: "000644"
owner: ec2-user

最新更新