Asked  8 Months ago    Answers:  5   Viewed   30 times

Whilst trying to setup a php environment on windows (using wamp) to use the Amazon PHP SDK, when i try to run a sample test I get the following error:

Fatal error: Uncaught exception 'cURL_Exception' with message 'cURL resource: Resource id #10; cURL error: SSL certificate problem: unable to get local issuer certificate (cURL error code 60). See for an explanation of error codes.' in C:wampwwwAWSSDKforPHPlibrequestcorerequestcore.class.php on line 848

I have already added the following line to my php.ini

curl.cainfo = C:Windowsca-bundle.crt

which is the location of a certificate i created using this VBS script VBS-Script

I have restarted my WAMP service also.

PHP index curl reference



Use this certificate root certificate bundle:

Copy this certificate bundle on your disk. And use this on php.ini

curl.cainfo = "path_to_certcacert.pem"
Wednesday, March 31, 2021
answered 8 Months ago

The server speaks only TLS 1.0 and trying to connect with SSL 2.0 or SSL 3.0 will cause the error you see. This means setting the version to 3 is exactly the wrong thing with this server. Apart from that the certificate chain is incomplete. The server only provides the leaf certificate, not the intermediate certificates until the trusted root. This will cause verification to fail.

Wednesday, March 31, 2021
answered 8 Months ago

You could use my Curl library:

$result = $this->curl->simple_get('');
Wednesday, March 31, 2021
answered 8 Months ago

You should only call curl_close() when you know you're done with that particular handle, or if switching from its current state to a new one (ie: changing a ton of options via curl_setopt() would be faster by going from a clean new handle than your current "dirty" one.

The cookiejar/file options are only strictly necessary for maintaining cookies between seperate curl handles/invokations. Each one's independent of the others, so the cookie files are the only way to share between them.

Wednesday, March 31, 2021
answered 8 Months ago

When you specify CURLOPT_POST, the post is sent as application/x-www-form-urlencoded.

But, from the curl_setopt manual page:

Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded.

So when you do

curl_setopt_array($ch, array(
  CURLOPT_POSTFIELDS => array('a' => 'b'),  // multipart/form-data
  CURLOPT_POST => true,                     // application/x-www-form-urlencoded

The data is being set as mulpart/form-data (by setting CURLOPT_POSTFIELDS to an array) and then reset as application/x-www-form-urlencoded (by setting CURLOPT_POST to true).

The other examples work because you're not changing the type once the data is set.

Saturday, August 7, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :