PHP mail error: stream_socket_enable_crypto (): thisstreamdoesnotsupportSSL/crypto

Source: Internet
Author: User
Today, when PHPMailer is called in the Yii Framework to send an email (using the smtp tls encryption authentication method), an error occurs, find an article to solve the problem (stackoverflow also has related questions and answers, click here to view ). The original text is as follows: & ldquo; Warning: stream_socket_enable_crypto (

Today, when PHPMailer is called in the Yii Framework to send an email (using the smtp tls encryption authentication method), an error occurs, find an article to solve the problem (stackoverflow also has related questions and answers, click here to view ). The original text is as follows:

"Warning: stream_socket_enable_crypto (): this stream does not support SSL/crypto" is a message you will often come when SS when doing mail send work in PHP, particle ly 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 xampp \ apache \ bin \ php. 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.

We often encounter this problem when using PHP to process emails, and 99% of this problem occurs because PHP extension openssl is not installed or enabled, after openssl is installed. remove the comments before extension = php_openssl.dll from The INI file, and restart apache to solve this problem.

In Linux, if PHP is compiled and installed, you can enter php-m in the command line, or check whether the openssl extension is installed in the browser. if not, you can use the following method to quickly install the SDK:

Sudo apt-get install openssl libcurl3-openssl-dev # need to install openssl # enter the php source code unzip directory 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

After the installation is successful, add the following in php. ini:

Extension = openssl. so

Restart apache and the following information is displayed in phpinfo, indicating that the installation is successful:

In this way, no error will be reported if PHPMailer is used to send emails encrypted by SMTP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.