PHP cURL error 'SSL certificate problem' when calling the MonCash API from shared hosting
poze a month ago100 gadeen
My MonCash integration works on my laptop, but on my shared host every request fails with cURL error 60: SSL certificate problem: unable to get local issuer certificate. A forum post says to set CURLOPT_SSL_VERIFYPEER to false. Is that OK?
Dyagnostik IA
Se IA ki fè l. Se pa yon repons — kominote a anba a konfime oswa korije l. Toujou verifye anvan ou fye l.
1 Repons
Do not disable certificate verification. With VERIFYPEER=false, anyone on the network path can impersonate the MonCash API, and that includes the requests that carry your client secret and your payment confirmations. Your server could be told a payment succeeded when it didn't.
Error 60 means your server's CA certificate bundle is missing or outdated, which is common on old shared hosts. Fix the trust store instead:
- Ask the host to update CA certificates or PHP. PHP 7.4 is end-of-life, so move to PHP 8.x if the panel allows it.
- Point cURL at a current bundle. Download
cacert.pemfrom the curl project (https://curl.se/docs/caextract.html), upload it outside your web root, and use it:
curl_setopt($ch, CURLOPT_CAINFO, '/home/youraccount/certs/cacert.pem');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
Or set it globally in php.ini: curl.cainfo = "/home/youraccount/certs/cacert.pem".
3. Check the server clock. A wrong date also makes valid certificates look invalid.
Refresh the bundle occasionally, since CAs change over time.
Konekte pou di lòt moun si li te mache.
Sign in and verify your email to post an answer.