Laravel php artisan config:缓存和AWS S3访问错误
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Laravel php artisan config:缓存和AWS S3访问错误,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2805字,纯文字阅读大概需要5分钟。
内容图文
![Laravel php artisan config:缓存和AWS S3访问错误](/upload/InfoBanner/zyjiaocheng/782/4dca804e21ae45819ae893b33bb2bdbd.jpg)
我面临一个非常奇怪的情况,我期待着你的帮助.
我与Laravel建立了S3连接.另一项服务是将视频文件上传到我的亚马逊桶.这些文件由用户通过我的网站下载.
但是,这个系统很快就无法运行.文件上传到存储桶,但用户无法访问此文件.
我找了很长时间的问题来源,但我找不到它.后来,当我在我的锻造服务器上说“php artisan config:clear”时,系统又开始工作了.然后我想通过说“php artisan config:cache”来优化系统.但是,一切都恢复到原来的状态.所以它开始不起作用.
我使用联盟/ flysystem-aws-s3-v3包作为包.我正在努力解决这个问题,请帮忙吗?
这是我的config / filesystem.php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
];
它是我的.env文件.
AWS_ACCESS_KEY_ID="****"
AWS_SECRET_ACCESS_KEY="****"
AWS_DEFAULT_REGION="eu-west-3"
AWS_BUCKET="tokbox****"
我用这些线检查并下载了我的控制器中的文件;
$tokboxapikey = env('OPENTOK_API_KEY');
$exist = Storage::disk('s3')->exists($tokboxapikey . '/'. $archive_id.'/archive.mp4');
if($exist)
{
return Storage::disk('s3')->download($tokboxapikey. '/'. $archive_id.'/archive.mp4');
}
解决方法:
更改
$tokboxapikey = env('OPENTOK_API_KEY');
至
$tokboxapikey = config('tokbox.api_key');
现在,laravel将为$tokboxapikey寻找bootstrap / cache / config.php.
内容总结
以上是互联网集市为您收集整理的Laravel php artisan config:缓存和AWS S3访问错误全部内容,希望文章能够帮你解决Laravel php artisan config:缓存和AWS S3访问错误所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。