Peer certificate CN= did not match expected CN=
Hello folks,
I got a bit of trouble with one of our CPanel VPS'es and SSL certificates (I think).
Error is in the title, it's an error that occurs when trying to contact the server with file_get_contents in php.
Googling or searching in this forum only yields results about SMTP and disabling SMTP restrictions which don't help in this case.
The test case I use in PHP:
error_reporting(E_ALL);
ini_set("display_errors", 1);
$content = file_get_contents('https://website.ext);
var_dump($content);
Which results in:
Warning: file_get_contents(): Peer certificate CN=`vps.domain.ext' did not match expected CN=`domain.ext' in /home/user/public/test.php on line 5
Warning: file_get_contents(): Failed to enable crypto in /home/user/public/test.php on line 5
Warning: file_get_contents(
-
Hoping someone can push me in the right direction, Thanks in advance.
If domain.ext has the same IP as vps.domain.ext then my 1st guess is that the problem is with SNI.0 -
Hi @Steven Lukas What version of PHP are you running for that site? Does the site have a valid SSL? 0 -
@quietFinn Thank you, thats the right direction I had to look. We have more VPS's and they all have multiple IP addresses. Since only 1 project runs on this VPS it never occured to me to use multiple IP's. To avoid stuff like this its better to have the hostname on its own IP (so it also can have its own rdns lookup). This has solved all the troubles. @cPanelLauren Yes, everything should be fine and up to date. Sectigo SSL certificate and php 7.2. The issue had to do with IP addresses. 0
Please sign in to leave a comment.
Comments
3 comments