Debian 6 下的 XAMPP:无法打开“ssl://”网址
我在使用 ssl:// 方案打开 URL 时遇到问题。详细说明:
phpinfo()
: http://pastie.org/2391404
示例代码:
$socket = @fsockopen("ssl://cgw.ubb.bg", 443, $errno, $errstr, 30);
if (!$socket) {
$err = "$errstr ($errno) - " . $socket;
echo "Unable to connect. $err";
} else {
echo "Connected.";
fclose($socket);
}
echo PHP_EOL;
我得到的回复是:
无法连接。 (0) -
(是的,我确实尝试使用 telnet/浏览器/等连接,主机/端口组合不是问题。)
换句话说,errno 是 0,并且没有提供错误消息。
当我将其放入 /opt/lampp/etc/php.ini
中时:
extension="openssl.so"
我收到此错误:
警告:PHP 启动:无法加载动态库 '/opt/lampp/lib/ php/extensions/no-debug-non-zts-20090626/openssl.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/openssl.so: 无法打开共享对象文件: 在 Unknown on line 0 中没有这样的文件或目录
唉,确实有那里没有 openssl.so
文件。
我的 XAMPP 平台是:i686-pc-linux-gnu
。
我的问题是:
我可以通过下载正确的文件并完成它来以某种方式“作弊”吗? 如果没有,我如何从源代码编译它并将其集成到 XAMPP 中而不将其分解?
编辑: 遗憾的是,到目前为止还没有给出可行的建议。考虑到我使用了现成的 XAMPP 安装(基本上解压了存档)并且 XAMPP 的使用相当广泛,我很惊讶没有其他人偶然发现这个问题。
I am having trouble opening URLs with the ssl:// scheme. Detailing:
phpinfo()
: http://pastie.org/2391404
Sample code:
$socket = @fsockopen("ssl://cgw.ubb.bg", 443, $errno, $errstr, 30);
if (!$socket) {
$err = "$errstr ($errno) - " . $socket;
echo "Unable to connect. $err";
} else {
echo "Connected.";
fclose($socket);
}
echo PHP_EOL;
What I get in response is this:
Unable to connect. (0) -
(Yes, I did try to connect with telnet/browser/etc., the host/port combo is not the problem.)
In other words, errno is 0, and no error message is provided.
When I put this in /opt/lampp/etc/php.ini
:
extension="openssl.so"
I am getting this error:
Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/openssl.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/openssl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Alas, there is indeed no openssl.so
file in there.
My XAMPP platform is: i686-pc-linux-gnu
.
My question is:
Can I "cheat" somehow by just downloading the proper file and be done with it?
If not, how could I compile it from source and integrate it into XAMPP without ripping it apart?
EDIT:
It's a shame no viable suggestions were given thus far. Having in mind I used a ready-made XAMPP installation (basically unpacked the archive) and that XAMPP is pretty broadly used, I am very surprised nobody else stumbled upon this problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在花了几个小时在 debian 上调试这个问题(安装了 libssl0.9.8 的挤压)后,我找到了解决方案。
我正在使用 dotdeb.org php 版本:php5-cgi 5.3.13-1~dotdeb.0(似乎不适用于 debian 默认包 5.3.3-7+squeeze13! - 此版本中仍然缺少 no_ticket )。
解决方案是像这样打开套接字:
之后您只需使用套接字,因为它是 fsockopen 资源。
After losing few hours to debug this problem on debian (squeeze with libssl0.9.8 installed) I've found a solution.
I'm using a dotdeb.org php version: php5-cgi 5.3.13-1~dotdeb.0 (doesn't seems to work with debian default package 5.3.3-7+squeeze13! - no_ticket is still missing in this version).
The solutions is to open the socket like this:
afterwards you simply use the socket as it was a fsockopen resource.
从您的 phpinfo() 中,可以使用 openssl :
PHP 允许将 openssl 构建到核心中,在这种情况下,它不需要位于单独的扩展中。 file_get_contents("https://cgw.ubb.bg/") 是否会给您同样的错误?
编辑:这似乎是 openssl 中的一个错误:我尝试了我提供的示例,并收到以下错误:
在谷歌搜索后,我发现多个错误报告/论坛帖子似乎都说这是 openssl lib 和远程服务器。显然,强制 openssl 到 sslv3 可以纠正问题,但我不知道如何使用 php 来做到这一点。
一些错误报告(与 php 无关):
https://bugs.launchpad .net/ubuntu/+source/curl/+bug/595415
http://forum.parallels.com/printthread.php?t=82502
From your phpinfo(), openssl is available :
PHP allows building openssl into the core, and in that case it does not need to be in a separate extension. Does a file_get_contents("https://cgw.ubb.bg/") gives you the same error ?
EDIT : This seems to be a bug in openssl : I tried the sample I provided, and got the following error :
After googling it, I found multiple bug reports / forum posts that all seem to say it is a problem between the openssl lib and the remote server. Apparently, forcing openssl to sslv3 corrects the problem, but I don't know how to do this with php.
Some bug reports (not related to php) :
https://bugs.launchpad.net/ubuntu/+source/curl/+bug/595415
http://forum.parallels.com/printthread.php?t=82502