cURL error 77: error setting certificate verify locations
•
Ditulis oleh Tim Pasti Oke
<?
$ch = curl_init()
curl_setopt($ch, CURLOPT_URL, 'https://login.aplikasidesa.net/curl.php')
curl_setopt($ch, CURLOPT_FAILONERROR, true) // Required for HTTP error codes to be reported via our call to curl_error($ch)
//...
curl_exec($ch)
if (curl_errno($ch)) {
$error_msg = curl_error($ch)
}
curl_close($ch)
if (isset($error_msg)) {
echo $error_msg
// TODO - Handle cURL error accordingly
}
?>
Relating to 'SSL certificate problem: unable to get local issuer certificate' error. Rather obviously this applies to the system sending the CURL request (and no the server receiving the request)
- Download the latest cacert.pem from https://curl.haxx.se/ca/cacert.pem
- Add the following line to php.ini (if this is shared hosting and you don't have access to php.ini then you could add this to .user.ini in public_html)
curl.cainfo="/path/to/downloaded/cacert.pem"Make sure you enclose the path within double quotation marks!!! - grant permission to your web server user like ngnix or www-data to read the file.
sudo chown www-data /etc/ssl/certs/cacert.pem - last step restart fpm and ngnix or apache
Butuh solusi instan siap pakai?
Dapatkan modul & script server production-ready langsung di web store kami.
Komentar
Belum ada komentar. Jadilah yang pertama memberikan komentar!