lyjs 发表于 2021-1-20 15:52:47

LNMP1.7 fsockopen(): failed to create an SSL handle

我用的lnmp1.7搭建的Linux centos7 lamp 环境php 是5.3版本我用CI框架的发送邮件功能一直提示出错,我排查原因最终确认是fsockopen() 函数执行不成功导致的。
然后我把函数单独拿出来测试:

error_reporting(-1);
ini_set('display_errors', 1);
$fp = fsockopen("ssl://smtp.163.com", 465, $errno, $errstr, 30);
var_dump($fp);


果然提示我有问题:fsockopen(): failed to create an SSL handle;   fsockopen(): Failed to enable crypto;

然后我先打印了phpinfo发现openssl 已经安装了,使用php -m 命令查看也有openssl扩展

有人说是证书问题,我下载了证书配置后重启apache 也不起作用,请教下这究竟是哪里的问题呢,我现在已经没有任何头绪了,请帮忙看一下 谢谢了

lyjs 发表于 2021-1-20 16:06:22

这是我的错误提示信息
A PHP Error was encountered
Severity: Warning

Message: fsockopen(): failed to create an SSL handle

Filename: controllers/get_experience_class.php

Line Number: 132

A PHP Error was encountered
Severity: Warning

Message: fsockopen(): Failed to enable crypto

Filename: controllers/get_experience_class.php

Line Number: 132

A PHP Error was encountered
Severity: Warning

Message: fsockopen(): unable to connect to ssl://smtp.163.com:465 (Unknown error)

Filename: controllers/get_experience_class.php

Line Number: 132

bool(false)

licess 发表于 2021-1-20 18:57:07

你服务器是哪家?有些商家会屏蔽邮件相关的端口
页: [1]
查看完整版本: LNMP1.7 fsockopen(): failed to create an SSL handle