Developing software in the Real World

View an SSL certificate from the command line

I recently had some trouble with verifying an SSL in PHP on a client’s server that I couldn’t reproduce anywhere else. It eventually turned out that the client’s IT department was presenting a different SSL certificate to the one served by the website.

To help me diagnose this, I used this command line script to display the SSL certificate:

Running it against, the start looks like this:

In my case, I noticed that when I ran this script on the client’s server, the serial number and issuer were different, and that’s when I worked out that PHP was telling me the truth and that it didn’t trust the certificate!

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *