【发布时间】: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