phpopenssldovecotexim

PHP (7.1) issue with mail , openssl , certificate


In the php.ini I have:

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

this line allow email from PHP with SMTP to be sent from PHP es Wordpress or PHP application as i use mydomain.ext certificate.

Now that I need use composer I discovered this line generate SSL error when PHP app like composer try to download data. The error is:

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

If i remove the php.ini line

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

this issue is solved but i start to see all PHP mail fail so applications like Wordpress etc are unable to send email.

How I can have mail working and also solve the PHP SSL issue?

If i remove the openssl line with the certificate email sent with SMTP SSL will fail.

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

Thank you.


Solution

  • Solved https://github.com/composer/composer/issues/7797#issuecomment-440680491

    In centos the position seems to be little bit different How to add Certificate Authority in centos7?

    I found it on etc/pki/ca-trust/extracted/openssl