【问题标题】:PHP (7.1) issue with mail , openssl , certificate邮件、openssl、证书的 PHP (7.1) 问题
【发布时间】:2018-11-17 13:27:25
【问题描述】:

php.ini 我有:

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

当我使用 mydomain 时,此行允许从 PHP es Wordpress 或 PHP 应用程序发送来自 PHPSMTP 的电子邮件。 ext 证书。

现在我需要use composer 我发现当像composer 这样的PHP 应用程序尝试下载数据时,这一行会生成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 等应用程序无法发送电子邮件。 p>

如何让邮件正常工作并解决 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

谢谢。

【问题讨论】:

  • 您通常会将openssl.capath 设置为包含全局和(可能)本地证书的目录。如果您设置一个 cafile 而不是仅用于 all 套接字连接。
  • 嗨@mar​​io,我不知道如何解决这个问题。如果我删除 openssl.cafile 邮件停止工作但我解决了作曲家 SSL 问题,如果我继续我将有邮件工作但作曲家无法处理 SSL 问题。
  • 你已经提到了。如何回答capth 问题或您的 /etc/ssl/certs` 设置?另见How do you add a certificate authority (CA) to Ubuntu?
  • 嗨@mar​​io,感谢您的回答。我尝试用 capath 替换 cafile 尝试将路径设置为 /etc/ssl/certs 但电子邮件停止工作。在里面我看到了一些指向一些 ca-boundle.crt 的符号链接——从来不知道该做什么。我只是理解,因为我添加了 cafile 以指向我的域证书,这适用于电子邮件但不适用于服务器,因此邮件正在工作并使用正确的证书,如果我删除此作曲家可能会使用我不使用的信任服务器证书知道在哪里,但不适用于电子邮件。也许在我的域证书中,我需要包含其他东西......从来不知道。

标签: php openssl dovecot exim


【解决方案1】:

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

在 centos 中的位置似乎有点不同如何在 centos7 中添加证书颁发机构?

我在 etc/pki/ca-trust/extracted/openssl 上找到了它

【讨论】:

    猜你喜欢
    • 2019-03-22
    • 1970-01-01
    • 1970-01-01
    • 2019-07-31
    • 1970-01-01
    • 2021-02-20
    • 1970-01-01
    • 2018-03-15
    • 1970-01-01
    相关资源
    最近更新 更多