简体   繁体   English

调用openssl_pkey_new()时xampp openssl错误;

[英]xampp openssl errors when calling openssl_pkey_new();

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. 所以我试图让openssl在我的Windows安装xampp(1.7.3)上工作,这是用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). 这是我第二次在* amp安装上安装openssl但是第一次游泳(这是在同一台机器上的wamp安装,但我发现xampp更像是我的风格所以我切换了)。

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. 我读了php.net页面,告诉我需要设置openssl.cnf和ssleay.dll环境常量的可能性,我试过但没有改变。

A var_dump of OPENSSL_CONF resulted in the path: C:/xampp/apache/bin/openssl.cnf which is correct for my machine. OPENSSL_CONFvar_dump导致路径: C:/xampp/apache/bin/openssl.cnf这对我的机器是正确的。

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. 我检查了php目录的路径(ssleay32.dll和libeay32.dll所在的位置)是在我的路径系统var中定义的,而不是,所以我定义了它,重新启动了我的机器,并在此过程中重新启动了apache,但错误消息没有变化。

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. 我的xampp版本没有附带php_openssl.dll,因此我相信php.ini文档应该将它从可用的.dll列表中排除,就像我检查时一样。 I believe xampp comes compiles with a zend based extension instead. 我相信xampp会编译一个基于zend的扩展。

I am able to start openssl from the xampp gui, and I sucessfully created a private/public key pair. 我能够从xampp gui启动openssl,并且我成功地创建了一个私钥/公钥对。

phpinfo() reports: phpinfo()报道:

openssl OpenSSL support enabled openssl OpenSSL支持已启用
OpenSSL Library Version OpenSSL OpenSSL库版本OpenSSL
0.9.8l 5 Nov 2009 OpenSSL Header Version OpenSSL 0.9.8l 5 Nov 2009 0.9.8l 2009年11月5日OpenSSL标题版本OpenSSL 0.9.8l 2009年11月5日

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. 我在我的系统目录中假设的wamp安装中有一个旧的ssleay.dll和libeay32.dll但是我已经删除了它们。 (restarted after, and rebooted apache) (重启后重启apache)

I tried copying the openssl.cnf to the default directory'C:\\usr\\local\\ssl\\openssl.cnf' no change. 我试着将openssl.cnf复制到默认目录'C:\\ usr \\ local \\ ssl \\ openssl.cnf'没有变化。

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() : 也许你需要在调用openssl_pkey_new()时指定openssl.cnf文件的路径:

$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). 您可能还需要在$configArgs指定其他设置才能使函数正常工作(最近没有测试过)。 See also http://php.net/manual/en/function.openssl-csr-new.php for a description of supported further configuration arguments. 有关支持的其他配置参数的说明,另请参见http://php.net/manual/en/function.openssl-csr-new.php

You check the OPENSSL_CONF variable in xampp/apache/conf/extra/http-xampp.conf 检查xampp / apache / conf / extra / http-xampp.conf中的OPENSSL_CONF变量

Then start apache using the xampp/apache_start.bat NOT THE XAMPP CONTROL PANEL (its strange that when started from the control panel it doesn't work [maybe a current directory problem]) 然后使用xampp / apache_start.bat启动apache而不是XAMPP控制面板(奇怪的是,从控制面板启动时它不起作用[可能是当前目录问题])

This is for XAMPP 1.7.4 on Win7 64bit 这适用于Win7 64bit上的XAMPP 1.7.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM