【问题标题】:trouble including Google APIs client library for PHP on Google App Engine在 Google App Engine 上包含用于 PHP 的 Google API 客户端库的问题
【发布时间】:2015-03-04 06:47:32
【问题描述】:

我正在尝试在 App Engine 上使用 Google PHP 库,但无法正确获取包含路径。

从这里的说明:https://developers.google.com/api-client-library/php/start/installation我正在添加

set_include_path(get_include_path() . PATH_SEPARATOR . '/google-api-php-client/src');

我的代码,但它似乎没有正确包含文件。 我主要在include 'google-api-php-client/src/Google/autoload.php'; 上遇到错误

 PHP Warning:  include(): open_basedir restriction in effect.
 File(/base/data/home/apps/.../google-api-php-client/src/Google/autoload.php) is not within the allowed path(s)

我尝试了更多有创意的方法,例如:

set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__)).'/google-api-php-client/src');

但无济于事。在 localhost 上一切正常,但大概是因为它没有相同的包含路径限制。

任何建议表示赞赏!

【问题讨论】:

  • 由于默认的 include_path 包含应用程序的根目录,因此您无需在包含 google-api-php-client/src/Google/autoload.php 之前对其进行更改
  • 我同意前提,但文档表明您应该添加 set_path_include 行。还有什么是导致 PHP 警告的原因的解释?

标签: php google-app-engine google-api google-cloud-platform


【解决方案1】:

我的错误的根源是我使用 git 提交进行部署(未跟踪 google-api-php-client 文件夹),而不是直接使用部署脚本。当我从 GoogleAppEngineLauncher 部署时,一切都按预期工作。

【讨论】:

    猜你喜欢
    • 2017-07-29
    • 2013-11-05
    • 2016-12-03
    • 1970-01-01
    • 2014-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-21
    相关资源
    最近更新 更多