I'm using Google App Engine (GAE) both with Stripe and AWS, and I'm finding myself in quite the paradox. The Stripe PHP API requires the use of cURL, so I have to enable the google_app_engine.enable_curl_lite PHP directive in my php.ini. If I don't enable curl_lite, the Stripe API throws the error
PHP Fatal error: Call to undefined function Stripe\HttpClient\curl_init() in stripe/lib/HttpClient/CurlClient.php on line 80
If I do enable curl_lite, then the AWS API throws the error
PHP Fatal error: Uncaught exception 'Aws\Lambda\Exception\LambdaException' with message 'Error executing "Invoke" on "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/LAMBDAFUNCTIONNAMEGOESHERE/invocations"; AWS HTTP error: curl_multi_init'
It's quite the conundrum.
When GAE is configured to use curl_lite because Stripe requires it, the AWS API tries to use it and fails. Is there any way to instruct the AWS API and/or Guzzle not to use cURL even when it is enabled on the server?
If there are no configuration options for this, it may be good to add a configuration option to override the cURL detection and allow it to be disabled. In lieu of a config option to do this, could someone help me to patch AWS API/Guzzle to disable cURL even when it is detected?
@GeekLad Thanks for the information, from Guzzle, it no longer requires cURL in order to send HTTP requests. Guzzle will use the PHP stream wrapper to send HTTP requests if cURL is not installed. Alternatively, you can provide your own HTTP handler used to send requests. Guzzle Docs
Understood. The problem is that Guzzle performs the detection of cURL and
if you're trying to use cURL with Google App Engine it does not work. If I
disable cURL in my php.ini so that Guzzle works, it breaks other libraries
I'm using that require cURL. I need to be able to enable cURL on my host,
but prevent Guzzle from using cURL.
On Mon, May 23, 2016 at 2:41 PM cjyclaire [email protected] wrote:
@GeekLad https://github.com/GeekLad Thanks for the information, from
Guzzle https://github.com/guzzle/guzzle, it no longer requires cURL in
order to send HTTP requests. Guzzle will use the PHP stream wrapper to send
HTTP requests if cURL is not installed. Alternatively, you can provide your
own HTTP handler used to send requests. Guzzle Docs
http://docs.guzzlephp.org/en/latest/faq.htmlAlso, PHP SDK
http://docs.aws.amazon.com/aws-sdk-php/v3/guide/guide/configuration.html#http-handler
v3 now supports customize HTTP handler as well.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/aws/aws-sdk-php/issues/1004#issuecomment-221052448
That's true ;). Feel free to reopen the issue if you have further questions.
@GeekLad there is a way to specify the handler explicitly:
$handler = new GuzzleHttp\Handler\StreamHandler;
$client = new GuzzleHttp\Client(['handler' => $handler]);
Also, cURL _is_ supported by appengine, so if you're experiencing issues you should file a bug here. You're probably using curl_lite, and you just need to enable the full curl.so extension in your php.ini. See this documentation for more information.
@bshaffer I didn't realize you could enable the full cURL extension, I thought you had to use curl_lite, which is indeed what I'm doing. It may be I was looking at old documentation before they allowed access to the full cURL extension. Enabling the full curl.so extension should do the trick. Thanks!
Most helpful comment
@GeekLad there is a way to specify the handler explicitly:
Also, cURL _is_ supported by appengine, so if you're experiencing issues you should file a bug here. You're probably using
curl_lite, and you just need to enable the fullcurl.soextension in yourphp.ini. See this documentation for more information.