• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Test TLS version used for PHP

Written by Rahul, Updated on September 5, 2019

The howsmyssl.com website provides you the option to test TLS version used by your browser or PHP script. Put the below PHP script on your website document root and access in a web browser. This will return the TLS version used by your script to connect remote application.

1
2
3
4
5
6
7
8
<?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 "<h1>Your TLS version is: " . $json->tls_version . "</h1>\n";
?>

I have written this in a tls_test.php script and then accessed in a web browser. The result shows the PHP is using TLS 1.2. If your application is using lower version by default, then you can force PHP to use TLS 1.2 with cURL using this tutorial.

Test PHP TLS Version

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

1 Comment

  1. Avatar bgheimat Reply
    September 18, 2019 at 5:18 pm

    Many thanks for your info sharing.

Leave a Reply Cancel reply

Popular Posts

  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • (Solved) apt-add-repository command not found – Ubuntu & Debian 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy