Reputation: 57
I recently upgraded cURL to v7.42.1 because I need to use the constant CURL_SSLVERSION_TLSv1_1 which is only available in versions >= 7.34.0.
http://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html
It also requires PHP >= 5.5.19 or 5.6.3.
http://php.net/manual/en/curl.constants.php
I am using PHP v5.5.24.
The correct versions of cURL and PHP are confirmed via the command line:
[root@web ~]# php -v
PHP 5.5.24 (cli) (built: Apr 16 2015 06:33:00)
[root@web ~]# curl -V
curl 7.42.1 (x86_64-redhat-linux-gnu) libcurl/7.42.1 OpenSSL/1.0.1e zlib/1.2.3 c-ares/1.10.0 libidn/1.30 libssh2/1.5.0
The correct versions are also confirmed via phpinfo():
Core
PHP Version 5.5.24
curl
cURL support enabled
cURL Information 7.42.1
Age 3
Features
AsynchDNS Yes
CharConv No
Debug No
GSS-Negotiate No
IDN Yes
IPv6 Yes
krb4 No
Largefile Yes
libz Yes
NTLM Yes
SPNEGO Yes
SSL Yes
SSPI No
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host x86_64-redhat-linux-gnu
SSL Version OpenSSL/1.0.1e
ZLib Version 1.2.3
libSSH Version libssh2/1.5.0
Yet when I try to use CURL_SSLVERSION_TLSv1_1 in a PHP script (via apache or command line), I get the following notice:
PHP Notice: Use of undefined constant CURL_SSLVERSION_TLSv1_1 - assumed 'CURL_SSLVERSION_TLSv1_1'
The OS is CentOS 6.6. PHP is installed via the remi-php55 repo, and cURL is installed via the city-fan.org repo. I have restarted apache multiple times via both commands:
apachectl restart
service httpd restart
I have not restarted any other services, or the server itself.
I am at a loss for why the PHP constant CURL_SSLVERSION_TLSv1_1 is undefined. Any help would be appreciated!
Upvotes: 1
Views: 2396
Reputation: 145482
Those constants are only available when PHP has been recompiled against the newer libcurl version. They don't appear by just upgrading curl. They're guarded by a preprocessor directive:
#if LIBCURL_VERSION_NUM >= 0x072200
You'll have to use the numeric equivalent of that constant, which is 5
.
Upvotes: 1