You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey! I've made an executable that does some API calls. When an endpoint is called, an error is thrown.
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl
-errors.html) for .......
I suppose it has something to do with there being no ca-cert in the package. When fetching the ssl cert location for php with openssl_get_cert_locations() it states that the ssl dir is /ssl/certs but that does not exist.
I think make a bundled ca cert load from memory is more safe and convenience, I will try to implement this when I have time.
I have not made this yet, but I found that php supports load cafile from PHP stream for PHP stream (not for curl, but can do https request also), this will work for cli or micro:
Here's a demo:
<?php// let's say you have a ca pem bundle (whatever it's self-signed or trusted) "cert.pem", you may use /etc/ssl/cert.pem for trusted// makes a phar with the pem (run this with ini config "phar.readonly=0"$phar = newPhar('test.phar', 0, 'test.phar');
$phar->startBuffering();
$phar->addFile("play.php");
$phar->addFile("cert.pem");
$phar->setStub($phar->createDefaultStub("play.php"));
$phar->stopBuffering();
what's in play.php :
<?php// for php stream (like file_get_contents, fread things)$ctx = stream_context_create(['ssl' => [
// here we load the ca pem from the same dir, whether it's in phar or not'cafile' => __DIR__ . '/cert.pem'
]]);
file_get_contents("https://some.tls.site", context:$ctx);
Hey! I've made an executable that does some API calls. When an endpoint is called, an error is thrown.
I suppose it has something to do with there being no ca-cert in the package. When fetching the ssl cert location for php with
openssl_get_cert_locations()
it states that the ssl dir is/ssl/certs
but that does not exist.Does anybody know how to add a ca cert so the bundle has it?
The text was updated successfully, but these errors were encountered: