cURL error 60: SSL certificate problem: self signed certificate when making call with Cron Job

Hello, i’ve bumped to issue probably related to Local App.

First to explain my case. I use cron job to make local URL call through wp_safe_remote_get() (tried also and with wp_remote_request() with the same error ). However there is an error in the response “cURL error 60: SSL certificate problem: self signed certificate”.

Adding screenshot of the function and the debug
Link to cron function screenshot
Link to debug screenshot

When i make the request through the terminal there is no problem and it returns the expected response Screenshot

Here are the answers of the questions, that i saw in similar topic to help you better debug the issue

    • What version of Local are you using?
  • Version 5.10.3+5332
    • What Operating System and OS version is being used?
  • macOS Big Sur version 11.2.3
  1. Can you please provide your Local Log?
    • Does this happen for all sites in Local, or just one?
  • This probably will happen on all sites, but currently only on one site i need cURL request.
    • Do you have a screenshot of the error you are seeing in the browser?
  • Yes, provided debug screenshot above.

Yes that’s because curl doesn’t inherit keychain/macOS trust settings. That’s a separate tool with its own thang going on. You can have it trust your custom cert, google it, might be a headache.

You can temporarily disable cert verification but no clue what the option is for wp_safe_remote_get().

For example in file_get_content() you can pass a $context which is essentially curl options, one of them being ‘verify_peer’ => false.

    $options = array(
        'ssl' => array(
        'verify_peer' => false
        )
    );
$myOwnShit = file_get_contents($url, '', stream_context_create($options));

I’m facing a similar issue where on the same OS version localwp fails to point at /etc/ssl/cert.pem so no https requests can be verified.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.