无法找到套接字传输“ ssl”-在配置PHP时是否忘记启用它?
我花了很多小时来寻找该错误的解决方法。我已经尝试了这个主题的所有解决方案,但是没有运气。<? 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)
和代码:
<?phprequire_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文件是否存在:
;extension=php_openssl.dll
更改为
extension=php_openssl.dll
之后,请记住使用Appserver提供的任何控制面板或使用系统控制面板上的服务窗口来重新启动Apache。
同样要确保php_openssl.dll在系统可以访问的文件夹中,许多人通过将其复制到C:\ windows或C:\ windows \
system32来解决dll位置问题。尽管那不是必须的。
之后,使用phpinfo执行文件并检查其是否已启用。
我在某处已读到,无法查明,有些安装了类似wamp的php.ini,但实际上只有一个在运行,可能是您编辑了错误的那个?
以上是 无法找到套接字传输“ ssl”-在配置PHP时是否忘记启用它? 的全部内容, 来源链接: utcz.com/qa/407375.html