Curl request is failing on the SSL?












18














I have this code



    if(ereg("^(https)",$url))
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
// execute, and log the result to curl_put.log
$result = curl_exec($curl);


$error = curl_error($curl);


The error specified is



SSL read: error:00000000:lib(0):func(0):reason(0), errno 104


Any ideas on the cause










share|improve this question




















  • 1




    is this not the same question? stackoverflow.com/questions/3875674/…
    – Phill Pafford
    Oct 6 '10 at 20:26






  • 6




    not even close...
    – Matt Elhotiby
    Oct 6 '10 at 20:28






  • 1




    Please note that disabling VERIFYPEER or VERIFYHOST makes the connection vulnerable to MITM attacks.
    – Bruno
    Nov 21 '14 at 11:22
















18














I have this code



    if(ereg("^(https)",$url))
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
// execute, and log the result to curl_put.log
$result = curl_exec($curl);


$error = curl_error($curl);


The error specified is



SSL read: error:00000000:lib(0):func(0):reason(0), errno 104


Any ideas on the cause










share|improve this question




















  • 1




    is this not the same question? stackoverflow.com/questions/3875674/…
    – Phill Pafford
    Oct 6 '10 at 20:26






  • 6




    not even close...
    – Matt Elhotiby
    Oct 6 '10 at 20:28






  • 1




    Please note that disabling VERIFYPEER or VERIFYHOST makes the connection vulnerable to MITM attacks.
    – Bruno
    Nov 21 '14 at 11:22














18












18








18


6





I have this code



    if(ereg("^(https)",$url))
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
// execute, and log the result to curl_put.log
$result = curl_exec($curl);


$error = curl_error($curl);


The error specified is



SSL read: error:00000000:lib(0):func(0):reason(0), errno 104


Any ideas on the cause










share|improve this question















I have this code



    if(ereg("^(https)",$url))
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
// execute, and log the result to curl_put.log
$result = curl_exec($curl);


$error = curl_error($curl);


The error specified is



SSL read: error:00000000:lib(0):func(0):reason(0), errno 104


Any ideas on the cause







php curl libcurl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 6 '10 at 20:30

























asked Oct 6 '10 at 20:24









Matt Elhotiby

16.8k68193298




16.8k68193298








  • 1




    is this not the same question? stackoverflow.com/questions/3875674/…
    – Phill Pafford
    Oct 6 '10 at 20:26






  • 6




    not even close...
    – Matt Elhotiby
    Oct 6 '10 at 20:28






  • 1




    Please note that disabling VERIFYPEER or VERIFYHOST makes the connection vulnerable to MITM attacks.
    – Bruno
    Nov 21 '14 at 11:22














  • 1




    is this not the same question? stackoverflow.com/questions/3875674/…
    – Phill Pafford
    Oct 6 '10 at 20:26






  • 6




    not even close...
    – Matt Elhotiby
    Oct 6 '10 at 20:28






  • 1




    Please note that disabling VERIFYPEER or VERIFYHOST makes the connection vulnerable to MITM attacks.
    – Bruno
    Nov 21 '14 at 11:22








1




1




is this not the same question? stackoverflow.com/questions/3875674/…
– Phill Pafford
Oct 6 '10 at 20:26




is this not the same question? stackoverflow.com/questions/3875674/…
– Phill Pafford
Oct 6 '10 at 20:26




6




6




not even close...
– Matt Elhotiby
Oct 6 '10 at 20:28




not even close...
– Matt Elhotiby
Oct 6 '10 at 20:28




1




1




Please note that disabling VERIFYPEER or VERIFYHOST makes the connection vulnerable to MITM attacks.
– Bruno
Nov 21 '14 at 11:22




Please note that disabling VERIFYPEER or VERIFYHOST makes the connection vulnerable to MITM attacks.
– Bruno
Nov 21 '14 at 11:22












6 Answers
6






active

oldest

votes


















11














With SSL, make sure that you have openssl extension turned on from php.ini.






share|improve this answer























  • How do I turn that on?
    – Jake Sylvestre
    Feb 24 '16 at 0:32










  • in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
    – Zame
    Aug 9 '16 at 12:59



















30














I encountered a similar cryptic error while working with a third-party library. I tried the CURLOPT_SSL_VERIFY[PEER|HOST] but it made no difference. My error message was similar:



SSL read: error:00000000:lib(0):func(0):reason(0), errno 54


So I visited http://curl.haxx.se/libcurl/c/libcurl-errors.html, looking for the error code 54.



CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!


This was wrong though - I was making other HTTPS requests using curl in other parts of the application. So I kept digging and found this question, R & RCurl: Error 54 in libcurl, which had this gem:




The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time.




So, don't let the output of curl_error() mislead you. Instead, use curl_errno() to obtain the correct error code, which in this case was actually 56, CURLE_RECV_ERROR. Had the wrong host name...






share|improve this answer























  • I got errno 104, instead it was also really 56, thanks!
    – Graftak
    Mar 2 '17 at 13:42



















1














I've had the same problem. It turned out, that the ssl on the target system had a bad configuration.



After checking the php curl module, the GuzzleHttp version, the openssl version I called the link in the browser and it worked. But with curl --tlsv1 -kv https://www.example.com on the console there was still an error.



So I checked the ssl configuration at https://www.ssllabs.com/ssltest/ It was rated with B. And there where some Online Certificate Status Protocol (OCSP) errors I haven't seen before. Finally I changed my configuration on the target system to the suggestions at https://cipherli.st/ restarted the webserver and everything worked. The new rating at ssllabs is now A+.



My nginx configuration (Ubuntu 14.04, nginx 1.4.6-1ubuntu3.5):



ssl     on;
ssl_certificate /etc/ssl/certs/1_www.example.com_bundle.crt;
ssl_certificate_key /etc/ssl/private/www.example.com.key;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
ssl_session_cache shared:SSL:10m;
#ssl_session_tickets off; # Requires nginx >= 1.5.9
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify off; # Requires nginx => 1.3.7
ssl_dhparam /etc/ssl/private/dhparams.pem;
ssl_trusted_certificate /etc/ssl/startssl.ca.pem;
resolver 8.8.8.8 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=63072000; www.example.com; preload";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;





share|improve this answer





















  • In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
    – shawncampbell
    Jul 12 '18 at 23:34



















0














add this:




curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0);




I had the same error and worked fine for me.






share|improve this answer



















  • 4




    why use HTTPS at all if verify is off?
    – Marius Balčytis
    Feb 21 '14 at 8:36






  • 5




    if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
    – jipipayo
    Feb 21 '14 at 9:18






  • 1




    This just makes the connection vulnerable to MITM attacks (see this).
    – Bruno
    Nov 21 '14 at 11:21










  • no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
    – jipipayo
    Feb 5 '15 at 15:01





















0














I had the same error printed by the function curl_error but this is not necessarily related to SSL. It is better to print the precise error number with the function curl_errno and you can diagnose better from there. In my case it returned me a 52 error code and I could debug from there, in fact the other server was not sending any data.






share|improve this answer





























    -1














    I think you mean to use CURLOPT_SSL_VERIFYHOST, not CURLOPT_SSL_VERIFYPEER






    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3876563%2fcurl-request-is-failing-on-the-ssl%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      6 Answers
      6






      active

      oldest

      votes








      6 Answers
      6






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      11














      With SSL, make sure that you have openssl extension turned on from php.ini.






      share|improve this answer























      • How do I turn that on?
        – Jake Sylvestre
        Feb 24 '16 at 0:32










      • in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
        – Zame
        Aug 9 '16 at 12:59
















      11














      With SSL, make sure that you have openssl extension turned on from php.ini.






      share|improve this answer























      • How do I turn that on?
        – Jake Sylvestre
        Feb 24 '16 at 0:32










      • in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
        – Zame
        Aug 9 '16 at 12:59














      11












      11








      11






      With SSL, make sure that you have openssl extension turned on from php.ini.






      share|improve this answer














      With SSL, make sure that you have openssl extension turned on from php.ini.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Oct 6 '10 at 20:32

























      answered Oct 6 '10 at 20:26









      Sarfraz

      298k62467546




      298k62467546












      • How do I turn that on?
        – Jake Sylvestre
        Feb 24 '16 at 0:32










      • in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
        – Zame
        Aug 9 '16 at 12:59


















      • How do I turn that on?
        – Jake Sylvestre
        Feb 24 '16 at 0:32










      • in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
        – Zame
        Aug 9 '16 at 12:59
















      How do I turn that on?
      – Jake Sylvestre
      Feb 24 '16 at 0:32




      How do I turn that on?
      – Jake Sylvestre
      Feb 24 '16 at 0:32












      in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
      – Zame
      Aug 9 '16 at 12:59




      in the PHP.ini file if you are using WAMPP or XAMPP , but still, after enabling it, i am having the same error code
      – Zame
      Aug 9 '16 at 12:59













      30














      I encountered a similar cryptic error while working with a third-party library. I tried the CURLOPT_SSL_VERIFY[PEER|HOST] but it made no difference. My error message was similar:



      SSL read: error:00000000:lib(0):func(0):reason(0), errno 54


      So I visited http://curl.haxx.se/libcurl/c/libcurl-errors.html, looking for the error code 54.



      CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!


      This was wrong though - I was making other HTTPS requests using curl in other parts of the application. So I kept digging and found this question, R & RCurl: Error 54 in libcurl, which had this gem:




      The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time.




      So, don't let the output of curl_error() mislead you. Instead, use curl_errno() to obtain the correct error code, which in this case was actually 56, CURLE_RECV_ERROR. Had the wrong host name...






      share|improve this answer























      • I got errno 104, instead it was also really 56, thanks!
        – Graftak
        Mar 2 '17 at 13:42
















      30














      I encountered a similar cryptic error while working with a third-party library. I tried the CURLOPT_SSL_VERIFY[PEER|HOST] but it made no difference. My error message was similar:



      SSL read: error:00000000:lib(0):func(0):reason(0), errno 54


      So I visited http://curl.haxx.se/libcurl/c/libcurl-errors.html, looking for the error code 54.



      CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!


      This was wrong though - I was making other HTTPS requests using curl in other parts of the application. So I kept digging and found this question, R & RCurl: Error 54 in libcurl, which had this gem:




      The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time.




      So, don't let the output of curl_error() mislead you. Instead, use curl_errno() to obtain the correct error code, which in this case was actually 56, CURLE_RECV_ERROR. Had the wrong host name...






      share|improve this answer























      • I got errno 104, instead it was also really 56, thanks!
        – Graftak
        Mar 2 '17 at 13:42














      30












      30








      30






      I encountered a similar cryptic error while working with a third-party library. I tried the CURLOPT_SSL_VERIFY[PEER|HOST] but it made no difference. My error message was similar:



      SSL read: error:00000000:lib(0):func(0):reason(0), errno 54


      So I visited http://curl.haxx.se/libcurl/c/libcurl-errors.html, looking for the error code 54.



      CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!


      This was wrong though - I was making other HTTPS requests using curl in other parts of the application. So I kept digging and found this question, R & RCurl: Error 54 in libcurl, which had this gem:




      The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time.




      So, don't let the output of curl_error() mislead you. Instead, use curl_errno() to obtain the correct error code, which in this case was actually 56, CURLE_RECV_ERROR. Had the wrong host name...






      share|improve this answer














      I encountered a similar cryptic error while working with a third-party library. I tried the CURLOPT_SSL_VERIFY[PEER|HOST] but it made no difference. My error message was similar:



      SSL read: error:00000000:lib(0):func(0):reason(0), errno 54


      So I visited http://curl.haxx.se/libcurl/c/libcurl-errors.html, looking for the error code 54.



      CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default!


      This was wrong though - I was making other HTTPS requests using curl in other parts of the application. So I kept digging and found this question, R & RCurl: Error 54 in libcurl, which had this gem:




      The output you see is from lib/ssluse.c in libcurl's source code and the "errno" mentioned there is not the libcurl error code but the actual errno variable at that time.




      So, don't let the output of curl_error() mislead you. Instead, use curl_errno() to obtain the correct error code, which in this case was actually 56, CURLE_RECV_ERROR. Had the wrong host name...







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 23 '17 at 12:26









      Community

      11




      11










      answered Jul 4 '13 at 6:14









      Nick Caballero

      8651818




      8651818












      • I got errno 104, instead it was also really 56, thanks!
        – Graftak
        Mar 2 '17 at 13:42


















      • I got errno 104, instead it was also really 56, thanks!
        – Graftak
        Mar 2 '17 at 13:42
















      I got errno 104, instead it was also really 56, thanks!
      – Graftak
      Mar 2 '17 at 13:42




      I got errno 104, instead it was also really 56, thanks!
      – Graftak
      Mar 2 '17 at 13:42











      1














      I've had the same problem. It turned out, that the ssl on the target system had a bad configuration.



      After checking the php curl module, the GuzzleHttp version, the openssl version I called the link in the browser and it worked. But with curl --tlsv1 -kv https://www.example.com on the console there was still an error.



      So I checked the ssl configuration at https://www.ssllabs.com/ssltest/ It was rated with B. And there where some Online Certificate Status Protocol (OCSP) errors I haven't seen before. Finally I changed my configuration on the target system to the suggestions at https://cipherli.st/ restarted the webserver and everything worked. The new rating at ssllabs is now A+.



      My nginx configuration (Ubuntu 14.04, nginx 1.4.6-1ubuntu3.5):



      ssl     on;
      ssl_certificate /etc/ssl/certs/1_www.example.com_bundle.crt;
      ssl_certificate_key /etc/ssl/private/www.example.com.key;

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
      ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
      ssl_session_cache shared:SSL:10m;
      #ssl_session_tickets off; # Requires nginx >= 1.5.9
      ssl_stapling on; # Requires nginx >= 1.3.7
      ssl_stapling_verify off; # Requires nginx => 1.3.7
      ssl_dhparam /etc/ssl/private/dhparams.pem;
      ssl_trusted_certificate /etc/ssl/startssl.ca.pem;
      resolver 8.8.8.8 valid=300s;
      resolver_timeout 5s;
      add_header Strict-Transport-Security "max-age=63072000; www.example.com; preload";
      add_header X-Frame-Options DENY;
      add_header X-Content-Type-Options nosniff;





      share|improve this answer





















      • In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
        – shawncampbell
        Jul 12 '18 at 23:34
















      1














      I've had the same problem. It turned out, that the ssl on the target system had a bad configuration.



      After checking the php curl module, the GuzzleHttp version, the openssl version I called the link in the browser and it worked. But with curl --tlsv1 -kv https://www.example.com on the console there was still an error.



      So I checked the ssl configuration at https://www.ssllabs.com/ssltest/ It was rated with B. And there where some Online Certificate Status Protocol (OCSP) errors I haven't seen before. Finally I changed my configuration on the target system to the suggestions at https://cipherli.st/ restarted the webserver and everything worked. The new rating at ssllabs is now A+.



      My nginx configuration (Ubuntu 14.04, nginx 1.4.6-1ubuntu3.5):



      ssl     on;
      ssl_certificate /etc/ssl/certs/1_www.example.com_bundle.crt;
      ssl_certificate_key /etc/ssl/private/www.example.com.key;

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
      ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
      ssl_session_cache shared:SSL:10m;
      #ssl_session_tickets off; # Requires nginx >= 1.5.9
      ssl_stapling on; # Requires nginx >= 1.3.7
      ssl_stapling_verify off; # Requires nginx => 1.3.7
      ssl_dhparam /etc/ssl/private/dhparams.pem;
      ssl_trusted_certificate /etc/ssl/startssl.ca.pem;
      resolver 8.8.8.8 valid=300s;
      resolver_timeout 5s;
      add_header Strict-Transport-Security "max-age=63072000; www.example.com; preload";
      add_header X-Frame-Options DENY;
      add_header X-Content-Type-Options nosniff;





      share|improve this answer





















      • In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
        – shawncampbell
        Jul 12 '18 at 23:34














      1












      1








      1






      I've had the same problem. It turned out, that the ssl on the target system had a bad configuration.



      After checking the php curl module, the GuzzleHttp version, the openssl version I called the link in the browser and it worked. But with curl --tlsv1 -kv https://www.example.com on the console there was still an error.



      So I checked the ssl configuration at https://www.ssllabs.com/ssltest/ It was rated with B. And there where some Online Certificate Status Protocol (OCSP) errors I haven't seen before. Finally I changed my configuration on the target system to the suggestions at https://cipherli.st/ restarted the webserver and everything worked. The new rating at ssllabs is now A+.



      My nginx configuration (Ubuntu 14.04, nginx 1.4.6-1ubuntu3.5):



      ssl     on;
      ssl_certificate /etc/ssl/certs/1_www.example.com_bundle.crt;
      ssl_certificate_key /etc/ssl/private/www.example.com.key;

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
      ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
      ssl_session_cache shared:SSL:10m;
      #ssl_session_tickets off; # Requires nginx >= 1.5.9
      ssl_stapling on; # Requires nginx >= 1.3.7
      ssl_stapling_verify off; # Requires nginx => 1.3.7
      ssl_dhparam /etc/ssl/private/dhparams.pem;
      ssl_trusted_certificate /etc/ssl/startssl.ca.pem;
      resolver 8.8.8.8 valid=300s;
      resolver_timeout 5s;
      add_header Strict-Transport-Security "max-age=63072000; www.example.com; preload";
      add_header X-Frame-Options DENY;
      add_header X-Content-Type-Options nosniff;





      share|improve this answer












      I've had the same problem. It turned out, that the ssl on the target system had a bad configuration.



      After checking the php curl module, the GuzzleHttp version, the openssl version I called the link in the browser and it worked. But with curl --tlsv1 -kv https://www.example.com on the console there was still an error.



      So I checked the ssl configuration at https://www.ssllabs.com/ssltest/ It was rated with B. And there where some Online Certificate Status Protocol (OCSP) errors I haven't seen before. Finally I changed my configuration on the target system to the suggestions at https://cipherli.st/ restarted the webserver and everything worked. The new rating at ssllabs is now A+.



      My nginx configuration (Ubuntu 14.04, nginx 1.4.6-1ubuntu3.5):



      ssl     on;
      ssl_certificate /etc/ssl/certs/1_www.example.com_bundle.crt;
      ssl_certificate_key /etc/ssl/private/www.example.com.key;

      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
      ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
      ssl_session_cache shared:SSL:10m;
      #ssl_session_tickets off; # Requires nginx >= 1.5.9
      ssl_stapling on; # Requires nginx >= 1.3.7
      ssl_stapling_verify off; # Requires nginx => 1.3.7
      ssl_dhparam /etc/ssl/private/dhparams.pem;
      ssl_trusted_certificate /etc/ssl/startssl.ca.pem;
      resolver 8.8.8.8 valid=300s;
      resolver_timeout 5s;
      add_header Strict-Transport-Security "max-age=63072000; www.example.com; preload";
      add_header X-Frame-Options DENY;
      add_header X-Content-Type-Options nosniff;






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Sep 23 '16 at 14:58









      Markus D.

      864




      864












      • In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
        – shawncampbell
        Jul 12 '18 at 23:34


















      • In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
        – shawncampbell
        Jul 12 '18 at 23:34
















      In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
      – shawncampbell
      Jul 12 '18 at 23:34




      In my case I also needed to limit the ssl_protocols to TLSv1.2 as v1 and v1.1 conflicted with the rest of my environment.
      – shawncampbell
      Jul 12 '18 at 23:34











      0














      add this:




      curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0);




      I had the same error and worked fine for me.






      share|improve this answer



















      • 4




        why use HTTPS at all if verify is off?
        – Marius Balčytis
        Feb 21 '14 at 8:36






      • 5




        if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
        – jipipayo
        Feb 21 '14 at 9:18






      • 1




        This just makes the connection vulnerable to MITM attacks (see this).
        – Bruno
        Nov 21 '14 at 11:21










      • no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
        – jipipayo
        Feb 5 '15 at 15:01


















      0














      add this:




      curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0);




      I had the same error and worked fine for me.






      share|improve this answer



















      • 4




        why use HTTPS at all if verify is off?
        – Marius Balčytis
        Feb 21 '14 at 8:36






      • 5




        if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
        – jipipayo
        Feb 21 '14 at 9:18






      • 1




        This just makes the connection vulnerable to MITM attacks (see this).
        – Bruno
        Nov 21 '14 at 11:21










      • no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
        – jipipayo
        Feb 5 '15 at 15:01
















      0












      0








      0






      add this:




      curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0);




      I had the same error and worked fine for me.






      share|improve this answer














      add this:




      curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, 0);




      I had the same error and worked fine for me.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 31 '12 at 3:08









      wim

      158k50300430




      158k50300430










      answered Nov 4 '11 at 20:53









      jipipayo

      2,42512734




      2,42512734








      • 4




        why use HTTPS at all if verify is off?
        – Marius Balčytis
        Feb 21 '14 at 8:36






      • 5




        if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
        – jipipayo
        Feb 21 '14 at 9:18






      • 1




        This just makes the connection vulnerable to MITM attacks (see this).
        – Bruno
        Nov 21 '14 at 11:21










      • no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
        – jipipayo
        Feb 5 '15 at 15:01
















      • 4




        why use HTTPS at all if verify is off?
        – Marius Balčytis
        Feb 21 '14 at 8:36






      • 5




        if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
        – jipipayo
        Feb 21 '14 at 9:18






      • 1




        This just makes the connection vulnerable to MITM attacks (see this).
        – Bruno
        Nov 21 '14 at 11:21










      • no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
        – jipipayo
        Feb 5 '15 at 15:01










      4




      4




      why use HTTPS at all if verify is off?
      – Marius Balčytis
      Feb 21 '14 at 8:36




      why use HTTPS at all if verify is off?
      – Marius Balčytis
      Feb 21 '14 at 8:36




      5




      5




      if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
      – jipipayo
      Feb 21 '14 at 9:18




      if you trust the channel, you can disregard the flag verify host, the encryption works, but you dont need to check the cert
      – jipipayo
      Feb 21 '14 at 9:18




      1




      1




      This just makes the connection vulnerable to MITM attacks (see this).
      – Bruno
      Nov 21 '14 at 11:21




      This just makes the connection vulnerable to MITM attacks (see this).
      – Bruno
      Nov 21 '14 at 11:21












      no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
      – jipipayo
      Feb 5 '15 at 15:01






      no if you are using this curl to get data from your own network, read unencrypted data do not implies attack, sometimes you dont need to encrypt this data.
      – jipipayo
      Feb 5 '15 at 15:01













      0














      I had the same error printed by the function curl_error but this is not necessarily related to SSL. It is better to print the precise error number with the function curl_errno and you can diagnose better from there. In my case it returned me a 52 error code and I could debug from there, in fact the other server was not sending any data.






      share|improve this answer


























        0














        I had the same error printed by the function curl_error but this is not necessarily related to SSL. It is better to print the precise error number with the function curl_errno and you can diagnose better from there. In my case it returned me a 52 error code and I could debug from there, in fact the other server was not sending any data.






        share|improve this answer
























          0












          0








          0






          I had the same error printed by the function curl_error but this is not necessarily related to SSL. It is better to print the precise error number with the function curl_errno and you can diagnose better from there. In my case it returned me a 52 error code and I could debug from there, in fact the other server was not sending any data.






          share|improve this answer












          I had the same error printed by the function curl_error but this is not necessarily related to SSL. It is better to print the precise error number with the function curl_errno and you can diagnose better from there. In my case it returned me a 52 error code and I could debug from there, in fact the other server was not sending any data.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 9 '13 at 9:56









          eloone

          2,86112131




          2,86112131























              -1














              I think you mean to use CURLOPT_SSL_VERIFYHOST, not CURLOPT_SSL_VERIFYPEER






              share|improve this answer


























                -1














                I think you mean to use CURLOPT_SSL_VERIFYHOST, not CURLOPT_SSL_VERIFYPEER






                share|improve this answer
























                  -1












                  -1








                  -1






                  I think you mean to use CURLOPT_SSL_VERIFYHOST, not CURLOPT_SSL_VERIFYPEER






                  share|improve this answer












                  I think you mean to use CURLOPT_SSL_VERIFYHOST, not CURLOPT_SSL_VERIFYPEER







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 7 '10 at 1:02









                  Eli

                  4,7452126




                  4,7452126






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3876563%2fcurl-request-is-failing-on-the-ssl%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Mossoró

                      Error while reading .h5 file using the rhdf5 package in R

                      Pushsharp Apns notification error: 'InvalidToken'