未启用 PHP 中的套接字传输“ssl”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1705856/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:35:23  来源:igfitidea点击:

Socket transport "ssl" in PHP not enabled

phpssliis-6fsockopen

提问by jelina

I'm having trouble enabling the socket transport "ssl" in PHP. When I run my script, I get the error:

我在 PHP 中启用套接字传输“ssl”时遇到问题。当我运行我的脚本时,我收到错误:

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.my.site.com:443 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)

警告:fsockopen() [function.fsockopen]:无法连接到 ssl://www.my.site.com:443(无法找到套接字传输“ssl” - 您在配置 PHP 时是否忘记启用它? )

I'm running IIS6 on Windows and this is what I've done so far to try to get it working:

我在 Windows 上运行 IIS6,这是我到目前为止所做的尝试让它工作:

  • uncommented the php_openssl.dll and php_sockets.dll extensions in php.ini
  • made sure PHP was loading the ini file I made changes to (it is, and it's definitely loading other extensions, so I'm fairly sure this isn't the problem)
  • made sure php_openssl.dll and php_sockets.dll were in the correct location
  • copied ssleay32.dll and libeay32.dll to the main PHP folder, the WINDOWS folder and the WINDOWS/system32 folder
  • made sure the Windows path variable included the location of PHP
  • made sure the file permissions were correct on all the relevant files.
  • 取消注释 php.ini 中的 php_openssl.dll 和 php_sockets.dll 扩展
  • 确保 PHP 正在加载我对其进行更改的 ini 文件(确实如此,而且它肯定正在加载其他扩展,所以我很确定这不是问题)
  • 确保 php_openssl.dll 和 php_sockets.dll 位于正确的位置
  • 将 ssleay32.dll 和 libeay32.dll 复制到 PHP 主文件夹、WINDOWS 文件夹和 WINDOWS/system32 文件夹
  • 确保 Windows 路径变量包含 PHP 的位置
  • 确保所有相关文件的文件权限都正确。

I've restarted IIS after pretty much every change, but I haven't had any luck. Is there anything obvious that I'm doing wrong? Is there anyway to troubleshoot this in smaller parts? (So I can figure out the problem by the process of elimination...?)

几乎每次更改后我都重新启动了 IIS,但我没有任何运气。有什么明显的我做错了吗?有没有办法在较小的部分解决这个问题?(所以我可以通过淘汰的过程找出问题......?)

Unfortunately Windows/IIS aren't my area of expertise--I've been put in charge because nobody else seems to know anything.

不幸的是,Windows/IIS 不是我的专业领域——我已经负责,因为其他人似乎什么都不知道。

采纳答案by jelina

Success!

成功!

After checking the log files and making sure the permissions on php_openssl.dll were correct, I googled the warning and found more things to try.

在检查日志文件并确保 php_openssl.dll 上的权限正确后,我搜索了警告并找到了更多可以尝试的方法。

So I:

所以我:

  • added C:\PHP\ext to the Windows path
  • added libeay32.dll and ssleay32.dll to C:\WINDOWS\system32\inetsrv
  • rebooted the server
  • 将 C:\PHP\ext 添加到 Windows 路径
  • 将 libeay32.dll 和 ssleay32.dll 添加到 C:\WINDOWS\system32\inetsrv
  • 重新启动了服务器

I'm not sure which of these fixed my problem, but it's definately fixed now! :)

我不确定其中哪些解决了我的问题,但现在肯定已经解决了!:)

I found these things to try on this page: http://php.net/manual/en/install.windows.extensions.php

我发现这些东西可以在这个页面上尝试:http: //php.net/manual/en/install.windows.extensions.php

Thanks for your help!

谢谢你的帮助!

回答by cikatomo

I was having problem in Windows 7 with PHP 5.4.0 in command line, using Xampp 1.8.1 server. This is what i did:

我在命令行中使用 PHP 5.4.0 在 Windows 7 中遇到问题,使用 Xampp 1.8.1 服务器。这就是我所做的:

  1. Rename php.ini-productionto php.ini(in C:\xampp\php\ folder)
  2. Edit php.iniand uncomment extension_dir=ext.
  3. Also uncomment extension=php_openssl.dll.
  1. 重命名php.ini-productionphp.ini(在 C:\xampp\php\ 文件夹中)
  2. 编辑php.ini并取消注释extension_dir=ext
  3. 也取消注释extension=php_openssl.dll

After that it worked fine.

之后它工作得很好。

回答by Selvakumar

In XAMPP Version 1.7.4 server does not have extension=php_openssl.dll line in php ini file. We have to add extension=php_openssl.dll in php.ini file

在 XAMPP 版本 1.7.4 中,服务器在 php ini 文件中没有 extension=php_openssl.dll 行。我们必须在 php.ini 文件中添加 extension=php_openssl.dll

回答by Marko Aleksi?

Ran into the same problem on Laravel 4 trying to send e-mail using SSL encryption.

在 Laravel 4 上尝试使用 SSL 加密发送电子邮件时遇到了同样的问题。

Having WAMPServer 2.2 on Windows 7 64bit I only enabled php_openssl in the php.ini, restarted WAMPServer and worked flawlessly.

在 Windows 7 64 位上安装 WAMPServer 2.2 我只在 php.ini 中启用了 php_openssl,重新启动 WAMPServer 并完美运行。

Did following:

做了以下:

  • Click WampServer -> PHP -> PHP extensions -> php_openssl
  • Restart WampServer
  • 点击 WampServer -> PHP -> PHP 扩展 -> php_openssl
  • 重启 WampServer

回答by Yogesh Unavane

Just uncomment extension=php_openssl.dllRestart Apache Service and that should help.

只需取消注释extension=php_openssl.dll重新启动 Apache 服务,这应该会有所帮助。

回答by Dale

I also ran into this issue just now while messing with laravel.

我刚才在弄乱laravel时也遇到了这个问题。

I am using wampserver for windows and had to copy the /bin/apache/apacheversion/bin/php.ini file to /bin/php/phpversion/php.ini

我在 windows 上使用 wampserver,不得不将 /bin/apache/apacheversion/bin/php.ini 文件复制到 /bin/php/phpversion/php.ini

回答by Ajay Singh

I am using XAMPP and came across the same error. I had done all those steps, added environmental variables path, copied the dll's every directory possible, to /php, /apache/bin, /system32, /syswow64, etc.. but still got this error.

我正在使用 XAMPP 并遇到了同样的错误。我已经完成了所有这些步骤,添加了环境变量路径,将 dll 的每个目录复制到 /php、/apache/bin、/system32、/syswow64 等,但仍然出现此错误。

Then after checking the apache error log, I noticed the issue with using brackets in path.

然后在检查 apache 错误日志后,我注意到在路径中使用括号的问题。

PHP: syntax error, unexpected '(' in C:\Program Files (other)\xampp\php\php.ini on line 707 0 server certificate does NOT include an ID which matches the server name

PHP:语法错误,意外的 '(' in C:\Program Files (other)\xampp\php\php.ini on line 707 0 服务器证书不包含与服务器名称匹配的 ID

If you have installed the server in "Program Files (x86)" directory, the same error might occur due to the non-escaped brackets.

如果您已将服务器安装在“Program Files (x86)”目录中,由于括号未转义,可能会出现相同的错误。

To fix this, open php.ini file and locate the line containing "include_path" and enclose the path with double quotes to fix this error.

要解决此问题,请打开 php.ini 文件并找到包含“include_path”的行并用双引号将路径括起来以修复此错误。

include_path="C:\Program Files (other)\xampp\php\PEAR"

include_path="C:\Program Files (other)\xampp\php\PEAR"