[英]Class 'Memcached' not found in Laravel Elastic Beanstalk App
我正在将 laravel 6 项目部署到亚马逊弹性 beanstalk 应用程序。 它正在运行 php7.3。
在eb deploy
期间
错误:ServiceError - 无法部署应用程序。
查看日志我发现它找不到 class 'Memcached'
@php 工匠 package:discover --ansi
Symfony\Component\Debug\Exception\FatalThrowableError : 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 Illuminate\Cache\MemcachedConnector::createMemcachedInstance()
/var/app/ondeck/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:48
2 Illuminate\Cache\MemcachedConnector::getMemcached([], [])
/var/app/ondeck/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php:21
这些实例正在运行 Amazon Linux 2.9。
我还添加了一个配置文件来使用这些包安装 memcache。 它是.ebextensions/memcache_installer.cfg.yml
,内容如下:
packages:
yum:
memcached: []
php-pecl-memcached: []
错误仍然没有 go 消失。 但是它们确实会安装,因为如果我尝试从实例中安装它们,我会得到 package 已经安装。
我们解决了它(至少在我们的回购中)。 删除php-pecl-memchached
,因为 amazon yum 版本具有 php 5 作为依赖项(我们在错误日志中看到了这一点)。
我们添加到.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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.