HomeCoder
HomeCoder

Reputation: 2575

How to check if installed OpenSSL version is >= 0.9.8k

I have a PHP 5.x script which requires OpenSSL 0.9.8k or higher.

In regard to OpenSSL, I found the following two relevant constants:

OPENSSL_VERSION_TEXT (with value 'OpenSSL 1.0.0c 2 Dec 2010')
OPENSSL_VERSION_NUMBER (with value '268435519')

Unfortunately, I have no clue how to do the mentioned check on these values.

Upvotes: 8

Views: 24666

Answers (3)

Aysennoussi
Aysennoussi

Reputation: 3860

If you like the one line command though:

php -r "echo OPENSSL_VERSION_NUMBER;"

Upvotes: 8

sisko
sisko

Reputation: 9910

printInfo() output should tell you if you have openSSL support

Upvotes: 2

Martin
Martin

Reputation: 6015

The source for version 0.9.8k has a constant OPENSSL_VERSION_NUMBER of 0x009080bf

<?php

if(OPENSSL_VERSION_NUMBER < 0x009080bf) {
    echo "OpenSSL Version Out-of-Date";
} else {
    echo "OpenSSL Version OK";
}

?>

Upvotes: 6

Related Questions