无法找到套接字传输“ssl"- 您是否在配置 PHP 时忘记启用它? [英] Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?

查看:23
本文介绍了无法找到套接字传输“ssl"- 您是否在配置 PHP 时忘记启用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很多时间在谷歌上搜索如何解决这个错误.我已经尝试了 this 主题中的所有解决方案,但没有走运.<代码>(我使用的是 Appserver 而不是 IIS 的唯一区别)它没有显示任何与 SSL 相关的内容.我还应该尝试什么?

I'm googling for how to this error a lot of hours. I've tried all solutions from this topic without luck. <? phpinfo(); ?> (the only difference I'm using Appserver instead of IIS) it doesn't show anything realated to SSL. What else should I try?

完整的错误信息:

<b>Warning</b>:  fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport &quot;ssl&quot; - did you forget to enable it when you configured PHP?) in <b>C:\AppServ\www\webgitz\test\class.smtp.php</b> on line <b>122</b><br />
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (27010016)

和代码:

<?php 

require_once "validation.php";

require_once "PHPMailer.php";


require_once "class.smtp.php";

$email= "foo@gmamcil.com";

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth   = true; // enable SMTP authentication
$mail->Port       =465;                    // set the SMTP server port
$mail->Host = "smtp.gmail.com"; // GMAIL's SMTP server
$mail->SMTPDebug = 2;
$mail->SMTPSecure = 'ssl';
$mail->Username   = "xxxxxx@gmail.com"; // GMAIL username
$mail->Password   = "*********"; // GMAIL password
$mail->AddReplyTo("XXXXX@gmail.com","AAAA"); // Reply email address
$mail->From = "XXXX@gmail.com";
$mail->FromName = "...."; // Name to appear once the email is sent
$mail->Subject = "...."; // Email's subject
$mail->Body = "Hello World,<br />This is the HTML BODY<br />"; //HTML Body
$mail->AltBody = "..."; // optional, commentA out and test
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($msg); // [optional] Send body email as HTML
$mail->AddAddress("$email", "fooo");  // email address of recipient
$mail->IsHTML(true); // [optional] send as HTML

if(!$mail->Send()) echo 'ok'; else echo 'error';    
?>

推荐答案

检查你的 php.ini 文件,如果你有这个:

Check your php.ini file, on it, if you have this:

;extension=php_openssl.dll

改成

extension=php_openssl.dll

之后,请记住使用 Appserver 提供的任何控制面板或使用系统控制面板上的服务窗口重新启动 Apache.

After that, remember to restart Apache, either using any control panel that Appserver offers, or using the services windows on the control panel of the system.

还要确保php_openssl.dll在系统可以访问的文件夹中,很多人为了解决dll位置问题,通过复制到C:\windows或C:\windows\system32来解决.虽然这不应该是必要的.

Also be sure that php_openssl.dll is on a folder that the system can reach, many people use to solve the problem of dll location problems by copying them to C:\windows or C:\windows\system32. Although that shouldn't be necessary.

之后,使用 phpinfo 执行一个文件并检查它是否已启用.

After that, execute a file with phpinfo and check that it's enabled.

我在某处读到过,无法确定,这种wamps的某些安装有不止一个php.ini,但只有一个是真正活动的,难道您编辑错了?

I have read somewhere, can't pinpoint it, that some installation of that kind of wamps have more that one php.ini, but only one is really active, could it be that you have edited the wrong one?

这篇关于无法找到套接字传输“ssl"- 您是否在配置 PHP 时忘记启用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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