stream_socket_enable_crypto(): this stream does not
来源:互联网 发布:农村淘宝合伙人加盟 编辑:程序博客网 时间:2024/06/16 16:25
今天在Yii框架中调用PHPMailer发送邮件的时候(使用SMTP的TLS加密认证方式)出现错误,在网上Google了下,找到一篇文章解决了问题(stackoverflow上也有相关问题及解答,点这里查看)。原文内容如下:
“Warning: stream_socket_enable_crypto(): this stream does not support SSL/crypto” is a message you will often come across when doing mail send work in PHP, particularly when your SMTP settings require you to connect using either a SSL or TLS mode.
The reason for the PHP warning message is actually not insidious at all – 99% of the time it refers to the fact that the OpenSSL extension hasn’t been enabled in your PHP configuration file – and under XAMPP this is almost always the case.
So a simple fix is to navigate to your php.ini file (for XAMPP it usually sits under xamppapacheinphp.ini), open it up and run a search for “extension=php_openssl.dll”.
Uncomment this line by removing the semi-colon at the front of it, save the file and then restart Apache via the Services panel.
以上英文的概要意思是:我们经常在使用PHP处理邮件发送的时候遇到这个问题,而且出现这个问题99%的原因是没有安装或启用PHP扩展openssl,安装openssl后,在php.ini文件去去掉extension=php_openssl.dll前的注释,然后重启apache即可解决这个问题。
在Linux下,如果是编译安装的PHP,可以通过在命令行输入php -m,也可以通过在浏览器查看phpinfo来检查是否安装了openssl扩展,如果没有,可以通过如下方式快速安装:
sudo apt-get install openssl libcurl3-openssl-dev #需要先安装openssl#进入php源码解压目录cd /path/to/php/ext/openssl/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-opensslmakesudo make install
安装成功后在php.ini中加上
extension=openssl.so
然后重启apache即可,看到phpinfo打印如下信息,则代表安装成功:
这样再使用PHPMailer以SMTP加密方式发送邮件就不会报错了。
- stream_socket_enable_crypto(): this stream does not
- Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in
- Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in
- PHP 里 this stream does not support SSL/crypto
- this instrument does not support osx
- This cache store does not support tagging
- This network connection does not exist
- This cache store does not suppor…
- This cache store does not support tagging.
- bug:TClientDataSet does not stream out "empty" TWideStringField values properly
- System.InvalidOperationException: The stream does not support reading
- This Virtual Directory does not allow contents to be listed.
- AutoComplPop does not support this version of vim (700)
- This parser does not support specification "null" version "null"
- tar: This does not look like a tar archive
- This text field does not specify an inputType ora hint
- “This text field does not specify an inputType ora hint”
- How Does Tiger Come Back From This, He Might Not
- tensorflow笔记(四)之MNIST手写识别系列一
- python入门
- ASP.NET Core
- 设计模式的应用场景(6)--外观模式
- 11.C++调用Lua全局变量(表)
- stream_socket_enable_crypto(): this stream does not
- Number Sequence
- 使用SMTP发送邮件报错:Expected response code 250 but got code "553", with message "553 Envolope sender mis...
- hdu 6181 Two Paths(最短路,spfa)
- bzoj1597 [Usaco2008 Mar]土地购买
- 浏览器关闭后,Session会话结束了么?
- 学习Linux-4.12内核网路协议栈(2.4)——接口层数据包的发送
- SQL查询语句包
- Chinese Rings 矩阵快速幂