OpenSSL 已启用但无法正常工作 [英] OpenSSL enabled but not working

查看:101
本文介绍了OpenSSL 已启用但无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Apache 2.2.13 和 PHP 5.2.12.只需手动安装 PHP 5.2.12(以访问所有扩展)并启用 OpenSSL.phpinfo() 表示 OpenSSL 已启用并在 2009 年 3 月 25 日运行 OpenSSL 0.9.8k.

I am running Apache 2.2.13 and PHP 5.2.12. Just installed PHP 5.2.12 manually (to have access to all extensions) and enabled OpenSSL. phpinfo() indicates OpenSSL is enabled and running OpenSSL 0.9.8k 25 Mar 2009.

我收到此错误:PHP 致命错误:调用未定义函数 ftp_ssl_connect().

I'm getting this error: PHP Fatal error: Call to undefined function ftp_ssl_connect().

我已经看到 PHP 手册建议ftp_ssl_connect() 仅在 ftp 模块和 OpenSSL 支持都静态构建到 php 时可用"并进一步指出您必须编译自己的 PHP 二进制文件"才能使用它使用 Windows.

I've seen where the PHP manual suggests 'ftp_ssl_connect() is only available if both the ftp module and the OpenSSL support is built statically into php' and further states that 'you must compile your own PHP binaries' to make it work with Windows.

我怀疑 phpinfo() 仅将 OpenSSL 指示为启用",因为我取消了extension=php_openssl.dll"行的注释,并且在正确的文件夹中具有正确的 dll,在环境变量中具有正确的路径.并且无论 phpinfo() 指示什么,都必须完成对 PHP 的静态构建.

I have the suspicion that phpinfo() only indicates OpenSSL as being 'enabled' because I have uncommented the line 'extension=php_openssl.dll' and have the correct dlls in the correct folders and the correct path in the environment variables. And perhaps a static build into PHP must be accomplished regardless of what phpinfo() indicates.

我相信分发的目的(如上所述)是为了动态扩展,但重新编译(对于 OpenSSL)是为了编码静态扩展.

I believe the objective of distribution (as described above) is for dynamic extensions, but recompiling (for OpenSSL) is to encode a static extension.

ftp 扩展工作正常(内置于 PHP 5.2).我用以下代码对此进行了测试:

ftp extension is working fine (built into PHP 5.2). I test this with the following code:

$conn_id = ftp_connect($url);$login_result = ftp_login($conn_id, $username, $password);ftp_close($conn_id);

$conn_id = ftp_connect($url); $login_result = ftp_login($conn_id, $username, $password); ftp_close($conn_id);

请注意,要检查 ssl,我只需将 ftp_connect 更改为 ftp_ssl_connect.到达这一行时,我的 Apache 错误日志文件中出现上述 PHP 错误.

Note that to check ssl, I only change ftp_connect to ftp_ssl_connect. When reaching this line, I get the PHP error above in my Apache error log file.

推荐答案

作为 文档状态 (引用你已经引用的内容):

注意:为什么这个函数可能不存在
ftp_ssl_connect() 只是如果 ftp 模块和已构建 OpenSSL 支持静态进入php,这意味着在 Windows 上,此功能将是在官方 PHP 版本中未定义.
使此功能可用在 Windows 上,您必须自己编译PHP 二进制文件.

Note: Why this function may not exist
ftp_ssl_connect() is only available if both the ftp module and the OpenSSL support is built statically into php, this means that on Windows this function will be undefined in the official PHP builds.
To make this function available on Windows you must compile your own PHP binaries.

你说你是手动"安装 PHP 的;但这可能仍然意味着您使用了来自 php.net 的官方"构建——这意味着您还没有编译自己的 PHP 二进制文件……所以,该功能不可用.

You say you installed PHP "manually" ; but this probably still means you used an "official" build from php.net -- which means you have not compiled your own PHP binaries... So, that function is not available.


没有魔法:看来你必须重新编译 PHP,在编译时使用正确的配置选项,如果你想能够使用那个函数......


There is no magic : it seems you'll have to re-compile PHP, using the right configuration options at compile-time, if you want to be able to use that function...

这里有一些关于此的文档:在 Windows 上构建您自己的 PHP -- 但是...祝你好运...我从来没有听说过在 Windows 上编译 PHP 很简单",实际上 (在 Linux 上并不难,但在编译方面 Linux 可能更适合一些)

Here's some documentation about that : Build your own PHP on Windows -- but... good luck... i've never heard it was "simple" to compile PHP on windows, actually (it's not that hard on Linux, but Linux is maybe a bit more well suited when it comes to compilation)


其他几个解决方案:


A couple of other solutions :

  • 为你的开发切换到 Linux(即使它只使用虚拟机) -- 但你可能仍然需要重新编译 PHP 来获得它(默认情况下可能未启用)
  • 只是不使用那个功能;毕竟,您知道您的托管服务是否会为您提供吗?(如果不能在生产服务器上使用,则无需在开发/测试机器上使用)
  • switching to Linux for your developments (even if it's only using a Virtual Machine) -- but you might still have to recompile PHP to get that (might not be enabled by default)
  • just not using that function ; after all, do you know if your hosting service will provide you with it ? (If you can't use it on your production server, no need to use on your development/testing machine)

这篇关于OpenSSL 已启用但无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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