php - GAE PHP 应用程序 : Unable to find the wrapper "gs"

标签 php google-app-engine google-cloud-platform google-cloud-storage

我正在标准 php73 Google App 引擎环境中编写一些非常简单的代码,遵循此处的文档:https://cloud.google.com/appengine/docs/standard/php/googlestorage/https://cloud.google.com/appengine/docs/standard/php/googlestorage/setup

php.ini(根据此场景的文档不需要,但以防万一)

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(): Unable to find the wrapper "gs" - did you forget to enable it when you configured PHP?

据我从文档中看到,应该不需要其他配置,因为 GAE 会在其环境中自动注册文件流包装器。

我错过了什么?谢谢!

最佳答案

事实证明,该文档适用于 PHP 5 环境,而不是 PHP 7(尽管没有说明)。在 PHP 7 中实现此功能的方法记录如下:

https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/appengine/php72/storage/src

我刚刚这样做了:

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

注册包装器。

关于php - GAE PHP 应用程序 : Unable to find the wrapper "gs",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56563982/

相关文章:

java - AppEngine Java 重新索引任务/映射器/作业

google-cloud-platform - Google Cloud IAM 的权限问题

google-cloud-platform - Google Cloud Load Balancer 突然抛出 504 超时(尽管架构没有变化)

jenkins - Kubernetes Helm 安装 stable/jenkins 调用 Master.* 值时出现弃用错误

PHP Cron 脚本不再能够执行

php - 在php中显示链接

php - 从开关“中断”,然后循环中的 'continue'

Python GAE 组合 requestHandler 和 BlobstoreUploadHandler 时遇到的问题

php - $GLOBALS 超全局在传递给函数时被修改

python - 是否可以在 AppEngine 上检索 uri block ?