I am trying to use constant CURL_SSLVERSION_TLSv1_2
in PHP, but I get error that such constant doesn't exist.
I checked PHP manual (http://php.net/manual/en/curl.constants.php) and it says that constant is Available since PHP 5.5.19 and 5.6.3
This is output of PHP/cURL versions on my local machine, where constant works fine
$ php -v
PHP 5.6.17-4+deb.sury.org~trusty+1 (cli)
$ php -i | grep -i curl
Additional .ini files parsed => /etc/php/5.6/cli/conf.d/20-curl.ini,
curl
cURL support => enabled
cURL Information => 7.35.0
$ php -r var_dump(defined('CURL_SSLVERSION_TLSv1_2')); var_dump(CURL_SSLVERSION_TLSv1_2);
bool(true)
int(6)
And on server where I'm trying to run that script, it's like this:
$ php -v
PHP 5.6.18 (cli) (built: Feb 4 2016 09:31:59)
$ php -i | grep -i curl
/etc/php.d/20-curl.ini,
curl
cURL support => enabled
cURL Information => 7.19.7
$ php -r "var_dump(defined('CURL_SSLVERSION_TLSv1_2')); var_dump(CURL_SSLVERSION_TLSv1_2);"
bool(false)
PHP Notice: Use of undefined constant CURL_SSLVERSION_TLSv1_2 - assumed 'CURL_SSLVERSION_TLSv1_2' in Command line code on line 1
string(23) "CURL_SSLVERSION_TLSv1_2"
As you can see, I have PHP 5.6.8, which should have that constant according to PHP manual, but cURL extension is older than on my local.
Could it be the reason of missing constant? Can I update cURL extension for PHP? or is there any other reason why it could be missing?
Other, older constants, as CURL_SSLVERSION_TLSv1
are present just fine on both servers.