Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pseudo code for detecting php version, operating system and a default location for CA bundle.
$os = php_uname("s");
$phpversion = floatval(substr(phpversion (),0,3));
$defaultcafile = "/QOpenSys/QIBM/ProdData/SC1/OpenSSL/openssl-0.9.7d/cert.pem";
else if ($os=="Linux")
$defaultcafile = "/etc/pki/tls/certs/ca-bundle.crt";
if(!file_exists($defaultcafile) && $userDidntProvideCABundle)
//possible security issue as you have to trust that the DNS and server below is not compromised.
$certFromWeb = readfile("");
//::TODO:: cache this cert so we don't send multiple requests. Have to add logic above to see if we have the cached cert
$defaultcafile = $certFromWeb;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.