Created
January 28, 2019 08:08
-
-
Save Langmans/12742f456d3b0d7ca0c514df8b64034f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cafileCheck() | |
{ | |
if(!__DEBUGGING__) | |
{ | |
return; | |
} | |
$cert_locations = openssl_get_cert_locations(); | |
if(is_file($cert_locations['default_cert_file'])) | |
{ | |
return; | |
} | |
if(empty($cert_locations['ini_cafile'])) | |
{ | |
echo '<h2>Setting openssl.cainfo in ', php_ini_loaded_file(), ' is required so host can be verified using Certificate Authority (CA) file.</h2>'; | |
} | |
elseif(is_file($cert_locations['ini_cafile'])) | |
{ | |
return; | |
} | |
else | |
{ | |
echo '<h2>invalid openssl.cafile path from ' . php_ini_loaded_file() . '(file does not exist)</h2>'; | |
} | |
echo <<<HTML | |
Example: | |
<pre>[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=C:\cacert\cacert.pem | |
</pre> | |
<a href="https://curl.haxx.se/docs/caextract.html">Download and place cacert.pem somewhere.</a> | |
HTML; | |
die; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment