4

I've got a server Apache/2.2.22 (Debian) with PHP/5.4.45-0+deb7u5.

I need to get a php environment variable that specifies which SSL protocol version is used between client and server (I mean TLS 1.1, TLS 1.2 etc.).

So, I will use that variable in a script to get different options using TLS 1.1 or TLS 1.2 etc...

That server has got OpenSSL/1.0.1t.

John
  • 499
  • 12
  • 20

1 Answers1

4

The SSL_PROTOCOL environment variable should have what you're looking for. It's documented in the Apache manual for mod_ssl, along with other SSL variables.

Note that some hosting environments may not make this variable available. If you don't see it, you may need to add SSLOptions +StdEnvVars to your web server configuration, or to an .htaccess file.

  • Adding SSLOptions +StdEnvVars to my .htaccess I've got a new environment variable called REDIRECT_SSL_PROTOCOL . At the present value of that variable is TLSv1.2 . Is that the variable I'm looking for? – John Dec 21 '16 at 17:18
  • 1
    Yep, that's the one. The prefixed `REDIRECT_` is probably an artifact of your mod_rewrite configuration. –  Dec 21 '16 at 17:22
  • Updating: on Apache 2.4/PHP 7.3 the environment variable is SSL_PROTOCOL. – John Oct 12 '20 at 13:10