【发布时间】: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