How to solve "SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"; also, how to upgrade to PHP 7 from 5?
| From: | inhahe | Date: | Wed, 02 Mar 2016 18:00:35 +0000 |
| Subject: | How to solve "SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"; also, how to upgrade to PHP 7 from 5? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-31386@lists.php.net to get a copy of this message | ||
I'm running phpBB3, and when it tries to send an email I get this error: SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
I tried getting help in #phpbb and on their message board, but nobody could help me. I think this is probably more a problem with my PHP setup than with phpBB3 specifically anyway.
The line that it reports the error at is this:
$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
Could that be an actual OpenSSL/certificate issue, or does that just mean that php can't open internet sockets?
Someone suggested to me that maybe the server uses a self-signed certificate or that the certificate doesn't exist on my Windows box, but the server is AT&T - specifically outbound.att.net - wouldn't that be big enough that I wouldn't have those problems? Also, I've gotten this problem with several other SMTP servers I've tried. I've never been able to connect to a single one out of about 5-6 I tried, with dozens of variations of connection settings, though error messages varied.. I've gotten about 5 different error messages, though "certificate verify failed" was by far the most common.
Should I try to get the server's certificate somehow and put that in my system manually? If so, how do I get the server's certificate and how do I put it in my system?
Also, I don't know if it matters, but the command 'php -r "print_r(openssl_get_cert_locations());"' returns this:
Array
(
[default_cert_file] => c:/usr/local/ssl/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => c:/usr/local/ssl/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => c:/usr/local/ssl/private
[default_default_cert_area] => c:/usr/local/ssl
[ini_cafile] =>
[ini_capath] =>
)
and c:\usr isn't a directory on my system. Is that something I have to change, and if so, how?
I hesitate to give the full error phpBB3 error message because that might make people think this is really a phpBB3 question, but since it may be useful, here it is:
Errno 2: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at [ROOT]/includes/functions_messenger.php line 1005<br />
Errno 2: fsockopen(): Failed to enable crypto at [ROOT]/includes/functions_messenger.php line 1005<br />
Errno 2: fsockopen(): unable to connect to ssl://outbound.att.net:465 (Unknown error) at [ROOT]/includes/functions_messenger.php line 1005
--
I did try upgrading to the latest version of PHP 5 (just today), but maybe I should upgrade to PHP 7? Amazingly I can't find any webpages that explain how to do that, though. Do I just copy over all the files and then copy over my old php.ini? Or would it be incompatible, and if so, what's different / how do I migrate my settings?
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus