我正在将laravel 6项目部署到亚马逊弹性beantalk应用程序中。它正在运行php7.3。
eb deploy
错误:ServiceError-无法部署应用程序。
查看日志,我发现它找不到类'Memcached'
@ php artisan包:发现--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: []
错误仍然无法消除。但是确实安装了它们,因为如果我尝试从实例中安装它们,则我已经安装了软件包。
我们解决了这个问题(至少在我们的仓库中)。删除php-pecl-memchached
,因为亚马逊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