Use openssl_error_string() after your openssl_* function is called:
while($e = openssl_error_string() ) {
print_r($e."\n");
}
On my Windows it outputs:
error:02001003:system library:fopen:No such process
error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib
error:02001003:system library:fopen:No such process
error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib
See the first note at this function openssl_pkey_new():
Note: You need to have a valid openssl.cnf installed for this function
to operate correctly. See the notes under the installation section for
more information.