【发布时间】:2014-02-21 02:02:06
【问题描述】:
(我正在使用这个库的最新版本:https://github.com/google/google-api-php-client)
简而言之,我的脚本在 localhost 上运行良好,但每当我上传到我们的生产或暂存环境时,它都会失败。
我现在正在使用本教程中的一个非常简单的测试脚本:http://blog.salteh.net/2012/10/google-analytics-api-and-service-accounts/
同样,这在 localhost 上完美运行,但在我们的生产和登台服务器上出错。
错误是:
HTTP Error: Unable to connect
从我们的错误日志中,我们得到:
2014-01-29 10:14:43 /classes/google-api-php-client-read-only/src/Google/IO/Stream.php 115 php_error {"error_message":"file_get_contents(compress.zlib:\/\/https:\/\/accounts.google.com\/o\/oauth2\/token): failed to open stream: operation failed"} php_error
我认为这一定是由于 file_get_contents() 无法正常工作或 zlib 压缩出错。
因此,我创建了一个简单的脚本来测试 (https://gist.github.com/jonmilsom/7771566cf55e042b4826),但这在 localhost 以及暂存和生产环境中都可以正常工作....如何进一步调试它?
【问题讨论】:
标签: google-analytics google-api file-get-contents zlib google-api-php-client