Hands-on AWS knowledge base for developers Managed Ops
Talk to Us

PHP cURL error 60: SSL certificate problem: self signed certificate

Export PDF Print-friendly layout with a copyright watermark; choose Save as PDF in the print dialog
PHP cURL error 60: SSL certificate problem: self signed certificate — PHP cURL error 60: SSL certificate problem: self signed certificate

原因

PHP cURL 请求的 HTTPS 目标使用自签证书,或本机 cURL CA 包未配置(常见于 Windows PHP 环境)。

解决

  1. php.ini:curl.cainfo="C:\php\cacert.pem" 与 openssl.cafile 同步配置;
  2. 自签场景:curl 选项加 CURLOPT_CAINFO 指向自签根证书;
  3. 生产环境不要用 CURLOPT_SSL_VERIFYPEER = false 关闭校验;
  4. 用 php -i | grep cainfo 确认配置已生效。