This issue happens to me when I try to set up a new VPS with AlmaLinux 9.5 and Control Web Panel 0.9.8.1200 for my website Magepow on a new VPS.
And Then I set up Magento 2.4.7-p3, setup google recaptcha for my contact form. But when I try to submit the contact form(using google recaptcha), it shows this bug:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php on line 80
When I try to use SMTP, it shows a bug:
cannot connect to host; error = stream_socket_client(): Unable to connect to ssl://smtp.gmail.com:465 (Unknown error) (errno = 0 )
After a lot of digging, I found the issue is we are missing our certificate for OpenSSL. So, I have fixed it by:
- Download the certificate at:
https://curl.se/docs/caextract.html (click on cacert.pem to download it) - Run this command line in SSH to find where to put the certificate
php -r “print_r(openssl_get_cert_locations());”
In my case, it shows like these:
Array
(
[default_cert_file] => /usr/local/opensslso/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => /usr/local/opensslso/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => /usr/local/opensslso/private
[default_default_cert_area] => /usr/local/opensslso
[ini_cafile] =>
[ini_capath] =>
)
- Change file cacert.pem to cert.pem and upload it to folder: /usr/local/opensslso
Note: The firewall can make this issue. You should turn off the firewall to check.
Hope it will help someone.
Leave a Reply