• Hi, I get this error message trying to download images:

    cURL Request Error:: SSL certificate problem: unable to get local issuer certificate.

    The site is a staging site with no SSL, is this needed to be able to download?
    Hosted at Pressidium.

    Thanks!

    • This topic was modified 2 years, 3 months ago by Anders Alhbin.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author dcooney

    (@dcooney)

    Hi @alhbin,
    Can you have a look at this answer and let me know if this helps?
    https://wordpress.org/support/topic/curl-error-unable-to-download-image-to-server/#post-10677859

    It will mean modifying core code, but it would really help me try to contain some of these errors that I can’t reproduce.

    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    • This reply was modified 2 years, 3 months ago by dcooney.

    Hello!

    OK, just to make sure I did it correct, I adjusted in the file “/wp-content/plugins/instant-images/api/upload.php” Correct place?

    In such case, sorry – no difference. Same error message.
    Also please check below code so I did it correct.

    BR // Anders

    // Confirm cURL is enabled
          if(in_array  ('curl', get_loaded_extensions())) {
    
             // Generate temp image from URL and store it on server for upload
             $ch = curl_init(); // Lets use cURL
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Anders added
             curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); // Anders added
             curl_setopt($ch, CURLOPT_URL, $img);
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
             $picture = curl_exec($ch);            
             
             // cURL error
             if (curl_error($ch)) {
                $response = array(
             		'error' => true,
             		'msg' => __('cURL Request Error:', 'instant-images') .': '. curl_error($ch),
             		'path' => '',
             		'filename' => ''
          		);
             }  
    Plugin Author dcooney

    (@dcooney)

    @alhbin I’m not seeing the CURLOPT_SSL_VERIFYHOST or CURLOPT_SSL_VERIFYPEER lines in your code sample. Looks like you added the wrong code.

    Can you please try the following.

    // Confirm cURL is enabled
    if(in_array  ('curl', get_loaded_extensions())) {
    
    // Generate temp image from URL and store it on server for upload
    $ch = curl_init(); // Lets use cURL
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_URL, $img);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
    $picture = curl_exec($ch);            
       
    // cURL error
    if (curl_error($ch)) {
       $response = array(
    		'error' => true,
    		'msg' => __('cURL Request Error:', 'instant-images') .': '. curl_error($ch),
    		'path' => '',
    		'filename' => ''
    	);
    }  

    Or copy replace the entire contents of upload.php with this gist.
    https://gist.github.com/dcooney/f50f2d7e680be69887d566d3ea9551d8

    Plugin Author dcooney

    (@dcooney)

    Also @alhbin, can you possibly provide some server specs so I can try to replicate?

    For example, what hosting environment are you using?

    OK, so the new code is working better, sorry if I got the wrong one at first.

    Then I got the permission error, but after changing permission from 341 to 755 on the uploads/instant-images folder, this was also solved! So now it works šŸ™‚

    However a couple of questions: This code change you now gave me, will you include this in next version, or will it be overwritten, and do it cause any security problems using it? (As someone mentioned in another support thread…)

    I am hosting all my and my clients sites on Pressidium, a dedicated WP hosting company. I guess I will have to do this manual permission change on all of the sites I now will use your plugin on? Is there then any risk of Pressidium changes this back again for some security reasons?

    Thanks!

    And by the way – If you need for testing, I can setup an account for you to work with on my Staging site, and also provide you with some FTP access to the same.

    Plugin Author dcooney

    (@dcooney)

    I’m going to run tests on my environments to see if this affects anything, if not I’ll add it into the plugin.

    And by the way ā€“ If you need for testing, I can setup an account for you to work with on my Staging site, and also provide you with some FTP access to the same.

    Thanks – appreciate that! If I need it I’ll reach out šŸ™‚

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘SSL error’ is closed to new replies.