【发布时间】:2019-09-12 15:41:34
【问题描述】:
我正在尝试从 AppEngine 上的 PHP 进行 BigQuery 调用。是否假设 BigQuery PHP 库必须包含在部署文件中,并且它们在运行时中不隐式可用?
简单实例化示例:
<?php
use Google\Cloud\BigQuery\BigQueryClient;
$bigQuery = new BigQueryClient();
?>
然后是不可避免的错误:
[error] 20#20: *2 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Class 'Google\Cloud\BigQuery\BigQueryClient' not found in /srv/index.php:5 Stack trace: #0 {main} thrown in /srv/index.php on line 3" while reading response header from upstream, client: , server: , request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/google-config/php-fpm.sock:"
是否期望这些库是隐含的过于假设性?
编辑:这是部署目录中的composer.json 文件(我非常困惑,因为app.yaml 应该是库的声明位置,不是吗?)
????我什至不确定如何指定版本或只是一般的 BQ。
{
"require": {
"google/cloud": "^0.99.0"
}
}
【问题讨论】:
-
你能给我们看看你的 composer.json 文件吗?你在那里添加了 BQ 库吗?
-
@Pentium10 可能就是问题所在。诚然,我对这个作曲家有点迷茫,但问题已随该文件更新。
-
composer 看起来不错,确保在您的 php 文件中包含 vendor/autoload.php
-
@Pentium10,谢谢,vendor/* 文件是否需要包含在部署包中?另外,是否假设所述目录在 CWD 中?
标签: php google-app-engine google-bigquery