Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP lib throwing error on Google App Engine due to cUrl #190

Closed
ilDon opened this issue Jun 30, 2017 · 2 comments
Closed

PHP lib throwing error on Google App Engine due to cUrl #190

ilDon opened this issue Jun 30, 2017 · 2 comments

Comments

@ilDon
Copy link

ilDon commented Jun 30, 2017

General information

  • SDK/Library version: "braintree/braintree_php": "3.23.1"
  • Environment: Production
  • Language, language version, and OS: PHP, 5.5 on Google App Engine Standard

Issue description

I'm deploying an app to Google App Engine standard environment, PHP 5.5, but I'm encountering the following issue when making any request through the Braintree PHP library:

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

I did set up the library specifying no gzip responses, as indicated here.

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

It appears however that the problem is caused by line 133 in Braintree\Http:

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

The cUrl lite implementation provided by GAE does not support CURLOPT_CAINFO. I did try to use CURLOPT_CAPATH instead, as suggested in the PHP documentation on [cUrl][2], but then I got an Authorization error from Braintree.

Also commenting out the line where CURLOPT_CAINFO is results in an Authorization error.

I've also submitted a question on Stackoverflow.

@ilDon
Copy link
Author

ilDon commented Jul 1, 2017

Turns out that we need to use the full cUrl library (requires billing being enabled on GAE).

I suggest that in the readme of the library it is specified that, on GAE, in the php.ini file the following line must be included extension = "curl.so".

It would also be worth mentioning in the readme of the library that the following line won't work: google_app_engine.enable_curl_lite = “1”, even if commenting out the line CURLOPT_CAINFO in Braintree\Http.

@lkorth
Copy link
Member

lkorth commented Jul 5, 2017

Thanks for the feedback @ghego1! I've updated the README to include this information with a link to this issue.

@lkorth lkorth closed this as completed Jul 5, 2017
hollabaq86 pushed a commit that referenced this issue May 12, 2020
BTTEXPAN-375 - Add disbursement type field and methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants