PHP (7.1) issue with mail , openssl , certificate - php

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.

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

Related

SSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

**
I got error during add dependency via composer.
**
[Composer\Downloader\TransportException] The
"https://repo.packagist.org/packages.json" file could not be
downloaded: SSL operation failed with code 1. Open SSL Error
messages: error:1416F086:SSL
routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto failed to open stream: operation failed
I had that same error on a virtual machine with its date/time not synced. So check that the date/time of the machine running composer is correctly synced. In my case, using Vagrant, I just had to halt and restart the machine.

fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086

Warning: fsockopen(): SSL operation failed with code 1.
OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in D:\vhosts\abc.com\httpdocs\system\library\mail.php on line 170
Warning: fsockopen(): Failed to enable crypto in D:\vhosts\abc.com\httpdocs\system\library\mail.php on line 170
Warning: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown error) in D:\vhosts\abc.com\httpdocs\system\library\mail.php on line 170
Notice: Error: (0) in D:\vhosts\abc.com\httpdocs\system\library\mail.php on line 179
My client's website is unable to send out email and above are the error messages when I use SMTP.
Below are the differences between test and live environments:
It works on testing environment but not on the live server. The testing environment was in linux and the live server is on Windows.
My client's email service provider is Google G Suite.
I tried the default PHP mail() and also SMTP.
Both are unable to send mail.
Any idea what is the root cause of these issues. How do I fix it? How to avoid this kind of scenarios?

Send email using XAMPP and codeigniter

fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate
verify failed
fsockopen(): Failed to enable crypto
fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Unknown
error)
-
Above are the errors that show up whenever I try to send an email.
I am using XAMPP and codeigniter
I only have windows defender and SmadAv (included this because other say its because of their anti-virus that is why they cannot send the email)
I already enabled extension=php_openssl.dll in the C:\xampp\php\php.ini
Please Help

Composer "Download failed" Error

i use xampp in Windows and my PHP Version is 5.5.15 .
need to install composer for Start work with laravel framework. but my problem is here, when i want install composer, be faced with this error :
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
The download failed repeatedly, aborting.
What should I do?
and is there a way to install laravel without using composer ?
You basically have to set the environment variable SSL_CERT_FILE to the path of the PEM file of the ssl-certificate downloaded from the following link : http://curl.haxx.se/ca/cacert.pem.
It took me a lot of time to figure this out.
For a detailed answer, you can have a look here: https://stackoverflow.com/questions/34590842/cannot-install-composer-on-mac-os-x
If you are using Kaspersky, try to disable the Encrypted connection scanning (or set the Scan encrypted connections upon request from protection components option) and try again.
If you have the Always scan encrypted connections you can get errors like these:
[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
[RuntimeException]
Failed to clone https://github.com/doctrine/inflector.git via https, ssh protocols, aborting.
- https://github.com/doctrine/inflector.git
Cloning into 'C:\Users\User\my-project\vendor\doctrine\inflector'...
fatal: unable to access 'https://github.com/doctrine/inflector.git/': SSL certificate problem: self signed certificate in certificate chain
- git#github.com:doctrine/inflector.git
Cloning into 'C:\Users\User\my-project\vendor\doctrine\inflector'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Errors in installing php composer on windows

While installing the composer to user the laravel framework, I got some errors :
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
file_get_contents(): Failed to enable crypto
file_get_contents(https://getcomposer.org/composer.phar): failed to open stream: operation failed
The download failed repeatedly, aborting.
I'm sure that the Openssl in php.ini is enable.
Having the OpenSSL extension enabled does not mean it is configured correctly.
It fails to validate the certificate for getcomposer.org. That means either some man-in-the-middle server messes with your request or you somehow did not configure the set of default CA Authorities. Your server operator can tell you more.
I have the same problem using wamp on windows 7, and I already enabled the openssl.dll in php.ini, still report the same error.
my problem is caused by the network provider,and I have no idea what's wrong with the them.
after I connect to a VPN network .it works like a charm.

Categories