PHP cURL Error

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • PHP cURL Error

    Hello

    I am facing an issue with cURL in my PHP application. When trying to make a secure HTTPS request, I am getting the following error:

    cURL error: SSL certificate problem: unable to get local issuer certificate

    Details:
    • Server Environment: Apache on Ubuntu 20.04
    • PHP Version: 7.4
    • cURL Version: 7.68.0

    Code Snippet

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api.example.com/data");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($ch);
    if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
    }
    curl_close($ch);


    I haveverified that the SSL certificate is valid and not expired. Downloaded and updated the cacert.pem file from cURL's website and configured php.ini:


    curl.cainfo = "/path/to/cacert.pem"

    Checked the server's openssl version and it is up-to-date.

    How can I resolve the "unable to get local issuer certificate" error in cURL?
    Are there any additional configurations I need to make in php.ini or my server environment?

    Any suggestions on how to solve this SSL issue would be greatly appreciated.



    Thank you in advance for your help!



    Best regards,
    nolanmaris


    msbi course

  • #2
    the most accurate conclusion is that PHP cURL is not successfully loading or using the CA bundle you configured. This can happen if the curl.cainfo path is incorrect, the file permissions prevent PHP from reading cacert.pem, Apache/PHP was not restarted after the change, Pokepath TD​ or PHP is using a different configuration file than expected. Additionally, on Ubuntu systems, cURL often relies on the system-wide CA store (/etc/ssl/certs/ca-certificates.crt), and pointing PHP directly to that file is frequently more reliable than using a manually downloaded CA bundle.​

    Kommentar

    Lädt...
    X