【问题标题】:Laravel: Making storage work on App EngineLaravel:让存储在 App Engine 上工作
【发布时间】:2014-05-21 14:14:21
【问题描述】:

我关注了Getting started with Laravel on PHP for App Engine,当我在本地开发中将存储路径更改为谷歌云存储时出现错误。

例如。

const BUCKET_NAME = "bucket-name";
$storage_path = "gs://" . BUCKET_NAME . "/storage";

这是错误异常:

file_put_contents(/meta/services.json): failed to open stream: No such file or directory

【问题讨论】:

  • 这是一个权限问题,当网络服务器没有对存储目录的写入权限时,可能会出现此问题。
  • 我正在使用 App Engine 启动器,已为存储桶设置了 full_write 权限。

标签: google-app-engine laravel-4 google-cloud-storage


【解决方案1】:

出于安全性和可扩展性的原因,App Engine 不允许您写入本地文件系统。幸运的是,尽管您可以使用 file_put_contents() 之类的命令轻松读取和写入 Google Cloud Storage。该工具也在本地 dev_appserver 中进行了模拟。

查看 https://github.com/ajessup/laravel 了解经过调整以在 Google App Engine 上运行良好的 Laravel 版本,包括将 /meta/services.json 写入 GCS。

【讨论】:

  • /meta/services.json 发送到 GCS 会使每个请求耗时 3-4 秒。
【解决方案2】:

这可能会有所帮助。 http://forumsarchive.laravel.io/viewtopic.php?id=9341 “通过在 app/config/app.php 中定义清单路径来指向 Cloud Storage 路径,例如:'manifest' => 'gs://yourbucketname' .'/meta'”,

'manifest' => storage_path().'/meta' 时看起来像 storage_path() 问题,

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-27
    • 2010-10-10
    • 2017-08-18
    • 2022-10-14
    • 1970-01-01
    • 2019-08-01
    • 1970-01-01
    相关资源
    最近更新 更多