cURL error 60: SSL certificate: unable to get local issuer certificate

前端 未结 19 1547
天涯浪人
天涯浪人 2020-11-22 10:51

I use WAMP on a local development environment and am trying to charge a credit card but get the error message:

cURL error 60: SSL certificate problem:

19条回答
  •  没有蜡笔的小新
    2020-11-22 11:41

    What i did was use var_dump(openssl_get_cert_locations()); die; in any php script, which gave me the information about defaults that my local php was using:

    array (size=8)
      'default_cert_file' => string 'c:/openssl-1.0.1c/ssl/cert.pem' (length=30)
      'default_cert_file_env' => string 'SSL_CERT_FILE' (length=13)
      'default_cert_dir' => string 'c:/openssl-1.0.1c/ssl/certs' (length=27)
      'default_cert_dir_env' => string 'SSL_CERT_DIR' (length=12)
      'default_private_dir' => string 'c:/openssl-1.0.1c/ssl/private' (length=29)
      'default_default_cert_area' => string 'c:/openssl-1.0.1c/ssl' (length=21)
      'ini_cafile' => string 'E:\xampp\php\extras\ssl\cacert.pem' (length=34)
      'ini_capath' => string '' (length=0)
    

    As you can notice, i have set the ini_cafile or the ini option curl.cainfo. But in my case, curl would try to use the "default_cert_file" which did not exist.

    I copied the file from https://curl.haxx.se/ca/cacert.pem into the location for "default_cert_file" (c:/openssl-1.0.1c/ssl/cert.pem) and i was able to get it to work.

    This was the only solution for me.

提交回复
热议问题