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.