调用openssl_pkey_new()时,xampp openssl错误. [英] xampp openssl errors when calling openssl_pkey_new();

查看:120
本文介绍了调用openssl_pkey_new()时,xampp openssl错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图在用OpenSSL 0.9.8l构建的xampp(1.7.3)的Windows安装上使openssl正常工作.这只是我第二次在* amp安装上安装openssl,但是第一次是疯狂的(这是在同一台机器上进行的wamp安装,但是我发现xampp更适合我的风格,所以我切换了).

当我尝试一个简单的安装脚本时:

var_dump(getenv('OPENSSL_CONF'));
$privateKey = openssl_pkey_new();

while($message = openssl_error_string()){
    echo $message.'<br />'.PHP_EOL;
}

我收到一条返回的消息:

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  

我阅读了php.net页面,该页面告知我可能需要设置openssl.cnf和ssleay.dll环境常量,我尝试了一下,但没有任何改变.

OPENSSL_CONFvar_dump导致路径:C:/xampp/apache/bin/openssl.cnf,这对我的机器是正确的.

我检查是否在我的路径系统var中定义了php目录(ssleay32.dll和libeay32.dll所在的位置)的路径,但没有定义,因此我定义了它,重新启动了我的机器,并在此过程中重新启动了Apache,但错误消息没有变化.

我的xampp版本不带有php_openssl.dll,因此,我认为php.ini文档应该像检查时一样将其从可用的.dll列表中排除.我相信xampp会使用基于zend的扩展名进行编译.

我能够从xampp gui启动openssl,并且成功创建了一个私钥/公钥对.

phpinfo()报告:

openssl已启用OpenSSL支持
OpenSSL库版本OpenSSL
0.9.8l 2009年11月5日OpenSSL标头版本OpenSSL 0.9.8l 2009年11月5日

我认为我的系统目录中有wamp安装中的旧ssleay.dll和libeay32.dll,但此后我将其删除. (此后重新启动,然后重新启动apache)

我尝试将openssl.cnf复制到默认目录'C:\ usr \ local \ ssl \ openssl.cnf'.

我还阅读了线程和线程,但给出的答案是相关的,但未能提供帮助或不存在. /p>

有人对我接下来应该检查的内容有什么想法,或者我错过了哪些明显的事情?

解决方案

也许在调用openssl.cnf文件的路径.openssl-pkey-new.php"rel =" noreferrer> openssl_pkey_new() :

$configArgs = array(
    'config' => '/etc/openssl/openssl.cnf',
    // ...
);
openssl_pkey_new($configArgs);

您可能还需要在$configArgs中指定其他设置才能使该功能正常工作(最近尚未测试). 另请参见 http://php.net/manual/zh/function.openssl -csr-new.php 获取有关受支持的其他配置参数的说明.

so I am trying to get openssl working on my windows installation of xampp(1.7.3) which is built with OpenSSL 0.9.8l. This is only my second time to install openssl on an *amp install but the first time went swimmingly(it was a wamp install on the same machine, but I found that xampp was more my style so I switched).

when I attempted a simple setup script:

var_dump(getenv('OPENSSL_CONF'));
$privateKey = openssl_pkey_new();

while($message = openssl_error_string()){
    echo $message.'<br />'.PHP_EOL;
}

I got a returned message:

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  

I read the php.net page that informed me about the possibility of needing to set the openssl.cnf and ssleay.dll environment constants, I tried that but nothing changed.

A var_dump of OPENSSL_CONF resulted in the path: C:/xampp/apache/bin/openssl.cnf which is correct for my machine.

I checked that the path to the php directory (where ssleay32.dll and libeay32.dll are located) was defined in my path system var, and it was not, so I defined it, restarted my machine, and in the process rebooted apache, but no change in the error messages.

my version of xampp did not come with a php_openssl.dll and as such I believe the php.ini document should exclude it from the list of available .dlls as it did when I checked. I believe xampp comes compiles with a zend based extension instead.

I am able to start openssl from the xampp gui, and I sucessfully created a private/public key pair.

phpinfo() reports:

openssl OpenSSL support enabled
OpenSSL Library Version OpenSSL
0.9.8l 5 Nov 2009 OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009

there was an old ssleay.dll and libeay32.dll from the wamp install I presume in my systems directory but I have deleted them since. (restarted after, and rebooted apache)

I tried copying the openssl.cnf to the default directory'C:\usr\local\ssl\openssl.cnf' no change.

I also read this thread and this thread but the answers given were relevant but failed to help or were non-existant.

Anyone have any ideas on what I should check next or anything obvious that I missed?

解决方案

Maybe you need to specify the path to your openssl.cnf file when calling openssl_pkey_new():

$configArgs = array(
    'config' => '/etc/openssl/openssl.cnf',
    // ...
);
openssl_pkey_new($configArgs);

You may also need to specify additional settings in $configArgs for the function to work (have not tested that lately). See also http://php.net/manual/en/function.openssl-csr-new.php for a description of supported further configuration arguments.

这篇关于调用openssl_pkey_new()时,xampp openssl错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆