首页 文章

Google API php快速入门listFiles()500内部错误

提问于
浏览
1

我试过Google的Example CLI PHP code . listFiles() 方法从Google的服务器引发500内部错误,如堆栈跟踪中所示:

bash-4.2 $ php test.php PHP致命错误:未捕获异常'Google_Service_Exception',显示消息'错误呼叫GET https://www.googleapis.com/drive/v2/files?maxResults=10:(500)内部错误'在/home/ben/.../vendor/google/apiclient/src/Google/Http/REST.php: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在第79行

我删除了保存的凭据并再次尝试 . 这没有帮助:

bash-4.2 $ php test.php在浏览器中打开以下链接:https://accounts.google.com/o/oauth2/auth?respondse_type = code&redirect_uri = all%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致命错误:未捕获异常'Google_Service_Exception',并显示消息'错误呼叫GET https://www.googleapis.com/drive/v2/files?maxResults=10:(500)内部错误'/ home / ben /.../ vendor / google / apiclient / src / Google / Http / REST.php: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),对象(Google_Http_Request))#2 /home/ben/.../vendor/google/apiclient/src/Google/Servi ce / 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 / ...第79行/vendor/google/apiclient/src/Google/Http/REST.php

我搜索了github问题和标记为google-api-php-client的stackoverflow问题,但没有找到任何线索 . 我登录开发人员控制台并单击了Logs,这导致了文本

无法加载 .

有关如何从Google获取有关500错误的更详细信息的任何想法?

1 回答

  • 0

    尝试将此添加到调用Google Drive API date_default_timezone_set('America / New_York')的文件中代码的开头//更改所需的时区

    另外请确保设置了Google Cloud 端硬盘中的文件夹权限 .

相关问题