我已经尝试了所有......但不行!我确实在system32 windows文件夹上放了libeay32.dll和ssleay32.dll,我在php.ini上启用了php_openssl.dll扩展。但是,当执行以下代码时,会发生一些错误。我的openSSL版本是1.0.0。有人可以帮帮我吗?
代码:
$configargs = array(
'config' => 'openssl.cnf',
'digest_alg' => 'md5',
'x509_extensions' => 'v3_ca',
'req_extensions' => 'v3_req',
'private_key_bits' => 666,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'encrypt_key' => false,
);
$dn = array(
"countryName" => "DE",
"stateOrProvinceName" => "wubbla wubbla",
"localityName" => "wubbla",
"organizationName" => "Internet Widgits Pty Ltd",
"organizationalUnitName" => "Organizational Unit Name",
"commonName" => "example.com",
"emailAddress" => "Email Address"
);
$csr = openssl_csr_new($dn, $privkey, $configargs);
// Show any errors that occurred here
while (($e = openssl_error_string()) !== false) {
echo $e . "\n";
}
错误:
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:02001002:system library:fopen:No such file or directory
error:2006D080:BIO routines:BIO_new_file:no such file
error:0E064002:configuration file routines:CONF_load:system lib
答案 0 :(得分:3)
好吧,根据错误消息,它无法fopen()配置文件,你配置为:
'config' => 'openssl.cnf',
它存在吗?尝试使用绝对路径,或相对于CWD。 p>