【发布时间】:2016-01-07 20:26:46
【问题描述】:
我尝试了来自 Google 的 Example CLI PHP code。 listFiles() 方法从 Google 的服务器抛出 500 内部错误,如堆栈跟踪所示:
bash-4.2$ php test.php PHP 致命错误:在 /home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php 中出现未捕获的异常“Google_Service_Exception”和消息“调用 GET https://www.googleapis.com/drive/v2/files?maxResults=10: (500) 内部错误” :79 堆栈跟踪: #0 /home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php(44): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request)) #1 /home/ben/.../vendor/google/apiclient/src/Google/Client.php(556): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) #2 /home/ben/.../vendor/google/apiclient/src/Google/Service/Resource.php(195): Google_Client->execute(Object(Google_Http_Request)) #3 /home/ben/.../vendor/google/apiclient/src/Google/Service/Drive.php(1783): Google_Service_Resource->call('list', Array, 'Google_Service_...') #4 /home/ben/.../test.php(78): Google_Service_Drive_Files_Resource->listFiles(Arra in /home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php on第 79 行
我删除了保存的凭据并重试。这没有帮助:
bash-4.2$ php test.php 在浏览器中打开以下链接: https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=urn%3A ietf%3Awg%3Aoauth%3A2.0%3Aoob&client_id=...&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&access_type=offline&approval_prompt=auto 输入验证码: ... 凭证保存到 /home/ben/.credentials/drive-php-quickstart.json PHP 致命错误:在 /home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php 中出现未捕获的异常“Google_Service_Exception”和消息“调用 GET https://www.googleapis.com/drive/v2/files?maxResults=10: (500) 内部错误” :79 堆栈跟踪: #0 /home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php(44): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request)) #1 /home/ben/.../vendor/google/apiclient/src/Google/Client.php(556): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) #2 /home/ben/.../vendor/google/apiclient/src/Google/Service/Resource.php(195): Google_Client->execute(Object(Google_Http_Request)) #3 /home/ben/.../vendor/google/apiclient/src/Google/Service/Drive.php(1783): Google_Service_Resource->call('list', Array, 'Google_Service_...')
#4 /home/ben/.../test.php(78): Google_Service_Drive_Files_Resource->listFiles(Arra in /home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php on第 79 行
我搜索了标记为 google-api-php-client 的 github 问题和 stackoverflow 问题,但没有找到任何线索。我登录到开发者控制台并单击日志,结果显示文本
加载失败。
知道如何从 Google 获取有关 500 错误的更详细信息吗?
【问题讨论】: