Php 创建CSR时出现OpenSSL错误0x2006D002

Php 创建CSR时出现OpenSSL错误0x2006D002,php,openssl,Php,Openssl,我有错误 error:2006D002:BIO routines:BIO_new_file:system lib 调用openssl\u csr\u new函数时 $pKey = openssl_pkey_new( $keyConfig ); $pCSR = openssl_csr_new( $sslConfig, $pKey ); 如果没有openssl.cnf,则在第一个函数中失败 $pKey = openssl_pkey_new( $keyConfig ); $pCSR = opens

我有错误

error:2006D002:BIO routines:BIO_new_file:system lib
调用
openssl\u csr\u new
函数时

$pKey = openssl_pkey_new( $keyConfig );
$pCSR = openssl_csr_new( $sslConfig, $pKey );
如果没有
openssl.cnf
,则在第一个函数中失败

$pKey = openssl_pkey_new( $keyConfig );
$pCSR = openssl_csr_new( $sslConfig, $pKey );
我尝试了最小的
openssl.cnf
和实际配置,但没有效果。如果我使用错误的openssl.cnf错误将是:

error:0E064002:configuration file routines:CONF_load:system lib
请问,你能帮我修改一下openssl.cnf的最小值吗?或者我需要修改一下

  • PHP5.3.28作为Apache mod
  • phpinfo:已启用OpenSSL支持
  • OpenSSL库版本0.9.8y 2013年2月5日
  • PHP已重新安装并已重新启动

已解决,我需要为OpenSSL函数指定$keyConfig:

$keyConfig = array(
    'config' => dirname($_SERVER['SCRIPT_FILENAME']) . '/store/openssl.cnf',
    ...
);
$sslConfig = array(
    "countryName" => 'XX',
    "stateOrProvinceName" => 'XX',
    "localityName" => 'XX',
    ...
);
$pKey = openssl_pkey_new( $keyConfig );
$pCSR = openssl_csr_new( $sslConfig, $pKey , $keyConfig );
$pCRT = openssl_csr_sign( $pCSR , null , $pKey , self::TIME_INTERVAL_WEEK , $keyConfig );
openssl_x509_export( $pCRT, $strCertificate );
openssl_pkey_export( $pKey, $strPrivateKey , null , $keyConfig );

openssl errstr 0x2006D002
返回
错误:2006D002:BIO例程:BIO_new_文件:系统库
。文件或目录可能不存在。错误是否发生在
keyConfig
sslConfig
中?我想,我已经找到了错误。Openssl_csr_new函数可以接受第三个参数-它必须是Openssl_pkey_new中的$keyConfig。我稍后检查下一个代码并在这里编写。