Using the “vitual path” (= ‘crt.crt’) is not possible to find the crt.crt.
However.
I’m using this:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '10');
curl_setopt($ch, CURLOPT_USERAGENT, 'MyPHP/1.0');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
My server I use:
curl_setopt($ch, CURLOPT_CAINFO, 'crt.crt');
On Output not work, so I put the file in subfolder in same location of .exe:
curl_setopt($ch, CURLOPT_CAINFO, exo_getglobalvariable('HEPublicationPath', '').'bin\crt\crt.crt');
$x[] = curl_exec($ch);
$x[] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$x[] = curl_error($ch);
curl_close($ch);
On PHP Exeoutpu:
array(3) { [0]=> bool(false) [1]=> int(0) [2]=> string(63) “SSL certificate problem: unable to get local issuer certificate” } {“is”:false}
On my server:
array(3) { [0]=> string(102) “{response}” [1]=> int(200) [2]=> string(0) “” }
Both using the same crt.crt.
I try this:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="%PATH%\bin\crt\cacert.pem"
[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile="%PATH%\bin\crt\cacert.pem"
Yes, the file exist in this path too! I make a md5_file and sha1_file to check this file too and a file_exist();
This NOT WORK too:
curl.cainfo="cacert.pem"
openssl.cafile="cacert.pem"
How I can do that?