Answer the question
In order to leave comments, you need to log in
Why does PHP cURL throw an error Problem with the SSL CA cert?
Please tell me, cURL in PHP, when trying to connect to a host via https, persistently gives an error "Problem with the SSL CA cert (path? access rights?)". The certificate at the address I am accessing is unverified, but I disable the need to verify the certificate in the options.
Here is the code:
if($cu=curl_init('https://example.com')) {
curl_setopt($cu, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($cu, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($cu, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cu, CURLOPT_SSLVERSION, 3);
curl_setopt($cu, CURLOPT_TIMEOUT, 30);
$res = curl_exec($cu);
curl_close($cu);
}
Answer the question
In order to leave comments, you need to log in
For those who use nginx+php-fpm scheme in chroot, copy
/usr/lib64/libnsspem.so
/usr/lib64/libsoftokn3.so
to chroot/lib64 directory.
There is also an option like this:
wget http://curl.haxx.se/ca/cacert.pem
cp cacert.pem /usr/local/etc/cacert.pem
echo "curl.cainfo = \"/usr/local/etc/cacert.pem\"" >> /etc/php.ini
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question