stream_socket_enable_crypto(): Peer certificate did not match expected Laravel Error on cPanel

stream_socket_enable_crypto(): Peer certificate did not match expected Laravel Error on cPanel

Here is how to solve the following error in WHM / cPanel:

stream_socket_enable_crypto(): Peer certificate CN=`xxxx.com' did not match expected CN=`smtp.sendgrid.net'

As of PHP 5.6 peer verification is enabled by default (http://php.net/manual/en/migration56.openssl.php).

If you are running WHM / cPanel navigate to WHM and Under Tweak Settings change the “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)” from “On” to “Off”, or navigate to “SMTP Restrictions” and disable it.

image 6 - stream_socket_enable_crypto(): Peer certificate did not match expected Laravel Error on cPanel
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

1 comment
  • Hi Stefan;

    This may not be a secure way as the setting is server wide and opens any user to bypass the mail serve exim?

    I would prefer using an alternative like csf and tweak as below:

    SMTP_BLOCK= 1 () //adds allowed gids to access below port via exim 25,465(implicit tls mail submission ),587(explicit tls on mail submission)
    SMTP_ALLOW_LOCAl=1 (allow users to connect to port 25 via scripts but only via exim binary/sendmail symlinked to exim too)

    SMTP_PORTS=25,465,57

    Not sure if it sorts the specific problem above i would have to test this.

%d bloggers like this: