2019-06-12 13:57
浏览 67

GAE PHP应用程序:无法找到包装器“gs”

I am writing some very simple code in the standard php73 Google App engine environment, following the documentation here: and

php.ini (not required according to docs for this scenario, but just in case)

google_app_engine.allow_include_gs_buckets = "#default#"


file_put_contents("gs://#default#/hello.txt", "some text");

and getting the following error from Google App Engine

file_put_contents(): Unable to find the wrapper "gs" - did you forget to enable it when you configured PHP?

As far as I can see from the documentation there should be no other configuration required, as GAE registers the file stream wrapper automatically in their environment.

What am I missing? Thanks!

图片转代码服务由CSDN问答提供 功能建议

我正在标准 php73 Google App引擎环境中编写一些非常简单的代码, 这里的文档: / standard / php / googlestorage / https://


  google_app_engine.allow_include_gs_buckets =“#default#”

index.php: file_put_contents(“gs://#default#/hello.txt”,“some text”);

并获取 来自Google App Engine的错误

  file_put_contents():无法找到包装“gs” - 您是否忘记启用 它配置PHP时?

从文档中我可以看出,不需要其他配置,因为GAE会自动将文件流包装器注册到其中 环境。

我错过了什么? 谢谢!

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doumou1864 2019-06-13 07:25

    So it turns out the documentation is for the PHP 5 environment not PHP 7 (though that's not stated). The way to get this working in PHP 7 is documented here:

    I just did this:

    use Google\Cloud\Storage\StorageClient; 
    function register_stream_wrapper($projectId) {   
        $client = new StorageClient(['projectId' => $projectId]);

    to register the wrapper.

    解决 无用
    打赏 举报

相关推荐 更多相似问题