PHP cURL error 'SSL certificate problem' when calling the MonCash API from shared hosting
posée a month ago105 vuesen
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?
Diagnostic IA
Généré par IA. Ce n'est pas une réponse — la communauté ci-dessous le confirme ou le corrige. Vérifiez toujours avant de vous y fier.
1 réponse
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.
Connectez-vous pour dire si ça a marché.
Sign in and verify your email to post an answer.