HostOnNet Blog

PHP Script to verify TLS 1.2

Many payment providers recently moved to more secure SSL protocol TLS 1.2.

Many of these providers will sent you mail asking you to make sure your web server support TLS 1.2

Checklist: Preparing for the system upgrade to TLS 1.2

If your website is hosted, check with your hosting provider if they support TLS 1.2.
If you host your own website, check if your system already supports TLS 1.2.
If you or your hosted environment do not support TLS 1.2, arrange/request an upgrade.
Code your system to always use the highest version of TLS available; avoid hardcoding versions.

Here is a PHP Scrip that can verify if your web server can support TLS 1.2

tls_version.php

<?php 

$ch = curl_init('https://www.howsmyssl.com/a/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);

$json = json_decode($data);
echo $json->tls_version;
echo "\n";

Upload it to your web site and access it. If you see 1.2, your will be fine.

$ php tls_version.php 
TLS 1.2
$ 

Posted in PHP