Jac*_*ack 21 php sockets windows apache ssl
我正在谷歌上搜索这个错误很多小时.我没有运气就尝试过这个主题的所有解决方案.<? phpinfo(); ?>(唯一的区别是我使用的是Appserver而不是IIS)它没有显示任何与SSL相关的内容.我还应该尝试什么?
完整的错误消息:
<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 "ssl" - 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)
Run Code Online (Sandbox Code Playgroud)
和代码:
<?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';
?>
Run Code Online (Sandbox Code Playgroud)
Pat*_*maS 40
检查你的php.ini文件,如果你有这个:
;extension=php_openssl.dll
Run Code Online (Sandbox Code Playgroud)
改为
extension=php_openssl.dll
Run Code Online (Sandbox Code Playgroud)
之后,请记住使用Appserver提供的任何控制面板或使用系统控制面板上的服务窗口重新启动Apache.
还要确保php_openssl.dll位于系统可以访问的文件夹上,许多人通过将它们复制到C:\ windows或C:\ windows\system32来解决dll位置问题.虽然这不应该是必要的.
之后,使用phpinfo执行文件并检查它是否已启用.
我已经阅读过某个地方,无法确定它,那些运行的那些wamps有更多的那个php.ini,但只有一个真正活跃,可能是你编辑了错误的一个?
| 归档时间: |
|
| 查看次数: |
65185 次 |
| 最近记录: |