【问题标题】:Braintree PHP client library, and Google App Engine CURLOPT_CAINFO not implementedBraintree PHP 客户端库和 Google App Engine CURLOPT_CAINFO 未实现
【发布时间】:2017-06-30 17:56:47
【问题描述】:

我正在将应用程序部署到 Google App Engine standard 环境 PHP 5.5,但在通过 Braintree PHP 库发出任何请求时遇到以下问题:

PHP Fatal error:  Uncaught exception 'google\appengine\runtime\CurlLiteOptionNotSupportedException' with message     'Option 10065 is not supported by this curl implementation.' in /base/php_experiment_runtime/sdk/google/appengine/runtime/CurlLite.php:487
Stack trace:
#0 /base/php_experiment_runtime/sdk/google/appengine/runtime/CurlLite.php(215): google\appengine\runtime\CurlLite->setOption(10065, '/base/data/home...')
#1 /base/php_experiment_runtime/sdk/google/appengine/runtime/CurlLiteStub.php(1325): google\appengine\runtime\CurlLite->setOptionsArray(Array)
#2 /base/php_experiment_runtime/sdk/google/appengine/runtime/CurlLiteStub.php(1319): curl_setopt_array(Object(google\appengine\runtime\CurlLite), Array)
#3 /base/data/home/apps/s~enoronbackend/20170630t135950.402337515471573447/vendor/braintree/braintree_php/lib/Braintree/Http.php(135): curl_setopt(Object(google\appengine\runtime\CurlLite), 10065, '/base/data/home...')
#4 /base/data/home/apps/s~enoronbackend/20170630t135950.402337515471573447/vendor/braintree/braintree_php/li in /base/php_experiment_runtime/sdk/google/appengine/runtime/CurlLite.php on line 487

我确实设置了库,指定没有 gzip 响应,如 here 所示。

Braintree\Configuration::environment('production');
Braintree\Configuration::merchantId('XXX');
Braintree\Configuration::publicKey('XXX');
Braintree\Configuration::privateKey('XXX');
Braintree\Configuration::acceptGzipEncoding(false);

但问题似乎是由 Braintree\Http 中的第 133 行引起的:

curl_setopt($curl, CURLOPT_CAINFO, $this->getCaFile());

GAE 提供的 cUrl lite 实现不支持CURLOPT_CAINFO。正如cUrl 上的PHP 文档中所建议的那样,我确实尝试使用CURLOPT_CAPATH,但随后我收到了来自Braintree 的授权错误。

同时注释掉 CURLOPT_CAINFO 所在的行会导致授权错误。

【问题讨论】:

    标签: php google-app-engine braintree php-5.5


    【解决方案1】:

    如果有人感兴趣,结果证明解决方案非常简单,使用完整的 cUrl PHP 库而不是 GAE 提供的 lite 库。为此,您需要编辑 php.ini 文件:

    而不是

    google_app_engine.enable_curl_lite = “1”
    

    使用

    extension = "curl.so"
    

    【讨论】:

      猜你喜欢
      • 2014-05-07
      • 2013-11-05
      • 2019-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-21
      • 1970-01-01
      相关资源
      最近更新 更多