Debug School

rakesh kumar
rakesh kumar

Posted on

Laravel:Curl: Fix CURL (51) SSL error: no alternative certificate subject name matches

The error message "cURL error 51: SSL: no alternative certificate subject name matches target host name" occurs when cURL is unable to verify the SSL certificate for the specified host. This usually happens when the SSL certificate provided by the host does not match the hostname being accessed.

Problem:

Image description

Solution1
To resolve this issue, you can try the following steps:

To resolve this issue, you can try the following steps:

Check the hostname: Make sure that the hostname you are accessing matches the hostname specified in the SSL certificate. If the hostname is incorrect, you should update your cURL request to use the correct hostname.

Update cURL's CA certificate bundle: cURL uses a CA certificate bundle to verify SSL certificates. If the CA certificate bundle is outdated, it may not be able to verify the SSL certificate for the host. You can update cURL's CA certificate bundle by following the instructions provided by cURL: https://curl.haxx.se/docs/caextract.html

Disable SSL certificate verification: If you are unable to resolve the issue, you can try disabling SSL certificate verification by adding the following option to your cURL request:

Solution2

Image description

Top comments (0)