Skip to content
The Chat Archive
gpt-4-0125-preview· OpenAI WildChat-4.8M (AI2)

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see…

  1. User
  2. Assistant

    The cURL error 60 is a common issue that developers encounter when making HTTPS requests using cURL in PHP or other programming environments. This error occurs because cURL cannot verify the SSL certificate of the server it is trying to communicate with. The message "SSL certificate problem: unable to get local issuer certificate" indicates that the root certificate or the chain of certificates used by the server isn't recognized by your local server or development environment.

    Here’s how you can resolve this issue:

    1. Download CA Certificates

    First, you need a file with the latest CA (Certificate Authorities) certificates. You can download this file from the official cURL website or the Mozilla project, which is often used since it's regularly updated.

    2. Update php.ini Configuration

    Once you have the cacert.pem file, you need to configure PHP to use it for SSL requests. This involves updating the php.ini file.

    1. Locate your php.ini file. (Its location depends on your server setup. If you’re using XAMPP, it’s typically found in the php folder.)

    2. Open php.ini in a text editor.

    3. Search for curl.cainfo and openssl.cafile directives. They may be commented out by default (preceded by a ;).

    4. Update these directives with the path to your downloaded cacert.pem file. It should look something like this:

      curl.cainfo = "C:\path\to\cacert.pem"
      openssl.cafile = "C:\path\to\cacert.pem"
      

      Make sure to replace C:\path\to with the actual path where you’ve placed the cacert.pem file.

    5. Save the php.ini file and restart your web server for the changes to take effect.

    3. Verify or Update cURL Command (Optional)

    If you are manually running a cURL command in the terminal or a script and encounter this problem, you can specify the CA bundle to be used:

    curl --cacert /path/to/cacert.pem https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx03135b102ca72d&secret=111
    

    Troubleshooting

    • Ensure the path to cacert.pem in php.ini is correct.
    • Make sure to restart your web server or PHP-FPM service after making changes to php.ini.
    • If using a shared hosting, you may need to contact your hosting provider for assistance with updating CA certificates.

    Security Note

    It's important to keep the cacert.pem file updated to ensure you have the latest CA certificates for verifying SSL connections. Additionally, avoid disabling SSL verification in your cURL requests as this compromises the security of data transmission.