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.

0

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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?
Yep, that's the one. The prefixed REDIRECT_ is probably an artifact of your mod_rewrite configuration.
Updating: on Apache 2.4/PHP 7.3 the environment variable is SSL_PROTOCOL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.