Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»PHP»How to Test TLS version used for PHP

    How to Test TLS version used for PHP

    By RahulAugust 25, 20221 Min Read

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

    Advertisement

    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. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    PHP Arrays: A Beginner’s Guide

    Installing PHP on Pop!_OS

    How to Install PHP 8.x on Pop!_OS

    How to Install PHP on Ubuntu 22.04

    How To Install PHP (8.2, 8.1, 7.4) on Ubuntu 22.04

    View 1 Comment

    1 Comment

    1. bgheimat on September 18, 2019 5:18 pm

      Many thanks for your info sharing.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Configure Postfix to Use Gmail SMTP on Ubuntu & Debian
    • PHP Arrays: A Beginner’s Guide
    • Deploying Flask Application on Ubuntu (Apache+WSGI)
    • OpenSSL: Working with SSL Certificates, Private Keys and CSRs
    • How to Create and Read List in Python
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.