PHP (7.1) 邮件、openssl、证书问题

PHP (7.1) issue with mail , openssl , certificate

php.ini 我有:

[openssl]
openssl.cafile= /etc/ssl/cert/mydomaincabundle.crt

此行允许从 PHP 使用 SMTP 的电子邮件从 PHP es Wordpress 或 PHP 应用程序,因为我使用 mydomain.ext 证书。

现在我需要 use composer 我发现当 PHP 像 composer 这样的应用程序尝试下载数据时,这一行会生成 SSL 错误。错误是:

file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
    Now trying to download from source

如果我删除 php.ini

[openssl]
openssl.cafile= /etc/ssl/cert/mydomaincabundle.crt

此问题已解决,但我开始看到所有 PHP 邮件 失败,因此 Wordpress 等应用程序无法发送邮件.

如何让邮件正常工作并解决 PHP SSL 问题?

如果我删除 openssl 行和使用 SMTP SSL 发送的证书电子邮件将失败。

Connection: opening to ssl://domain.it:465, timeout=300, options=array ()
Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): Failed to enable crypto
Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to ssl://domain.it:465 (Unknown error)
SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

谢谢。

已解决https://github.com/composer/composer/issues/7797#issuecomment-440680491

在centos中这个位置好像有点不一样如何在centos7中添加Certificate Authority?

我在 etc/pki/ca-trust/extracted/openssl

上找到了它