How to use Google Cloud Storage for PHP?(如何使用 Google Cloud Storage for PHP?)
问题描述
So ive followed the guide on how to use GCS on their site: https://developers.google.com/appengine/docs/php/googlestorage/
But the following code does not work. I cannot access my bucket, and the CloudStorageTools is not even found.
require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php';
use googleappengineapicloud_storageCloudStorageTools;
// check if GCS bucket if writable
$my_bucket = 'gs://my_bucket/';
$check1 = is_writable($my_bucket); //returns nothing
class_exists("CloudStorageTools"); //returns false
I also added google_app_engine.allow_include_gs_buckets into the php.ini file. Still no support for GCS.
Anyone have some running code they could share?
I think it may have something to do with permissions set to your bucket. Make sure you added your app account email Application Settings -> Service Account Name.
I ported my app with no issues and using Smarty to write into and include from the bucket. I did not have to declare:
require_once 'google/appengine/api/cloud_storage/CloudStorageTools.php';
use googleappengineapicloud_storageCloudStorageTools;
and the app reads and writes to the bucket with no problems.
I have had however issues with some WordPress porting, when although the bucket existed and had properly setup access permission, for some reason app throws a Fatal Error and I can see it in the app logs, that application was trying to access the cloud storage via gs:// wrapper.
Hope that helps.
这篇关于如何使用 Google Cloud Storage for PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 Google Cloud Storage for PHP?
基础教程推荐
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01