Fixing PHP cURL SSL Error: Self Signed Certificate in Certificate Chain
php curl ssl errorself signed certificateverify peer falsecacert.pem configurationphp.ini ssl settings
Published·Modified·
When using PHP cURL to make HTTPS requests, you may encounter the error "SSL certificate problem: self signed certificate in certificate chain". This issue occurs because the client root certificate cannot be verified. Below are the solutions.

Method 1
Ignore certificate verification by adding the following code to your cURL method:
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
Disadvantage: You must add the above code to every cURL method, which can be cumbersome.
Method 2
Download the root certificate from the cURL official website: cacert.pem, then modify php.ini to include this certificate and restart your web server.
# Add to php.ini
[SSL]
curl.cainfo = "D:\xampp\php\cacert.pem"
openssl.cafile = "${curl.cainfo}"
Parts of this article reference: [PHP] PHP cURL https SSL certificate problem: unable to get local issuer certificate