Braintree PHP客户端库和Google App Engine CURLOPT_CAINFO未实现

问题描述 投票:0回答:1

我正在将应用程序部署到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的响应,表示在这里

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个回答
0
投票

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

代替

google_app_engine.enable_curl_lite = “1”

采用

extension = "curl.so"
© www.soinside.com 2019 - 2024. All rights reserved.