ssl - Certificate CA bundle file: PEM - PHP/cURL - Local install..? -
i'm using windows server 2008 r2 (with iis), php 5.6.0 , curl 7.36.0 test against paypal's tls test url:
$ch = curl_init(); curl_setopt($ch, curlopt_url, 'https://tlstest.paypal.com'); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_failonerror, true); curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_sslversion, 6); // curl_sslversion_tlsv1_2 curl_setopt($ch, curlopt_cainfo, dirname(__file__) . '\cacert.pem'); $result = curl_exec($ch); curl_close($ch);
when use curlopt_cainfo
, cacert.pem
http://curl.haxx.se/docs/caextract.html works , get:
paypal_connection_ok
when don't use curlopt_cainfo
error:
ssl certificate problem: unable local issuer certificate
i've tried this:
- mmc
- file > add/remove snap-in
- certificates (local computer)
- trusted root certification authorities > certificates
- all tasks > import
- select
cacert.pem
- message: "the import successful"
however has made no difference, still have use curlopt_cainfo
work.
is there way can install these root certificates on our windows server don't have use curlopt_cainfo
, cacert.pem
every call make..?
you can leverage php.ini set absolute path of cacert.pem located.
the directive curl.cainfo
set it, or @ least read value , place file @ right position.
Comments
Post a Comment