2017-06-30 16 views
0

我部署一個應用谷歌應用程序引擎standard環境,PHP 5.5,但使得通過布倫特裏PHP庫中的任何請求時,我遇到了以下問題:布倫特裏PHP客戶端庫,和谷歌應用程序引擎CURLOPT_CAINFO沒有實現

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); 

然而它看來,問題是由線路133布倫特裏\的Http造成的:通過GAE提供

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

捲曲精簡版實現不支持CURLOPT_CAINFO。我嘗試使用CURLOPT_CAPATH來代替,正如cUrl上的PHP文檔中所建議的那樣,但是我得到了Braintree的授權錯誤。

另外註釋掉CURLOPT_CAINFO的行會導致授權錯誤。

回答

0

如果有人感興趣,事實證明該解決方案非常簡單,使用完整的cUrl PHP庫而不是GAE提供的lite程序庫。要做到這一點,你需要編輯php.ini文件:

而不是

google_app_engine.enable_curl_lite = 「1」 

使用

extension = "curl.so" 
相關問題