How to Update CURL with CPanel on CentOS 7

CURL is a simple module that allows you to connect and communicate to various types of servers using various types of protocols. Curl mainly supports http, https, ftp, gopher, telnet, dict, file, and ldap protocols. It also supports SMB, SMBS, IMAP, IMAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, TFT, HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, and user/password authentication.

We know that, an increasing amount of web applications has made the HTTP scripting more frequently requested and necessary. There is a high demand for such a tool which helps us to automatically extract information from the Web, upload, proxy or POST data to the web servers.

CURL is a simple commandline tool which can be used to do all these URL manipulations and data transfers. It is powered by libcurl, which is a library created by Daniel Stenberg.

It is mandatory to keep such softwares always updated, since there is a chance of hacking attempts, data diddling or loop holes due to old insecure versions. In this article, I'm discussing a simple method on how to update the Curl in a more efficient way to the latest available versions on a cPanel server.

First of all, check the current version installed on the server. Please see the current CURL version in my server below:

root@server1 [/usr/local/src]# /usr/bin/curl -V
curl 7.38.0 (x86_64-redhat-linux-gnu) libcurl/7.38.0 NSS/3.19.1 Basic ECC zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL UnixSockets

As you can see the CURL version is 7.38 and is compiled to support these many protocols like dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet and tftp.

We are going to configure CURL with Asynchronous DNS to improve its performance and make the requests more faster without any delays. Let's start our update process now.

Step 1. Download the latest Curl and Asynchronous DNS Package from their website and extract.

root@server1 [~]# cd /usr/local/src/
root@server1 [/usr/local/src]# wget
--2016-01-26 06:29:25--
Resolving ( 2a00:1a28:1200:9::2,
Connecting to (|2a00:1a28:1200:9::2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 809073 (790K) [application/x-gzip]
Saving to: ‘c-ares-1.10.0.tar.gz’

100%[=====================================================================================================>] 8,09,073 1.18MB/s in 0.7s

2016-01-26 06:29:26 (1.18 MB/s) - ‘c-ares-1.10.0.tar.gz’ saved [809073/809073]

root@server1 [/usr/local/src]#tar -xvf c-ares-1.10.0.tar.gz
root@server1 [/usr/local/src]# wget
--2016-01-26 06:29:59--
Resolving ( 2a00:1a28:1200:9::2,
Connecting to (|2a00:1a28:1200:9::2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4551902 (4.3M) [application/x-gzip]
Saving to: ‘curl-7.46.0.tar.gz’

100%[=====================================================================================================>] 45,51,902 3.79MB/s in 1.1s

2016-01-26 06:30:01 (3.79 MB/s) - ‘curl-7.46.0.tar.gz’ saved [4551902/4551902]

root@server1 [/usr/local/src]#tar -xvf curl-7.46.0.tar.gz

Step 2. Configure, make and install the Asynchronous DNS package.

root@server1 [/usr/local/src/c-ares-1.10.0]# ./configure

root@server1 [/usr/local/src/c-ares-1.10.0]# make
make all-am
make[1]: Entering directory `/usr/local/src/c-ares-1.10.0'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -DCARES_BUILDING_LIBRARY -DCARES_SYMBOL_HIDING -fvisibility=hidden -g0 -O2 -Wno-system-headers -MT libcares_la-ares__close_sockets.lo -MD -MP -MF .deps/libcares_la-ares__close_sockets.Tpo -c -o libcares_la-ares__close_sockets.lo `test -f 'ares__close_sockets.c' || echo './'`ares__close_sockets.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -DCARES_BUILDING_LIBRARY -DCARES_SYMBOL_HIDING -fvisibility=hidden -g0 -O2 -Wno-system-headers -MT libcares_la-ares__close_sockets.lo -MD -MP -MF .deps/libcares_la-ares__close_sockets.Tpo -c ares__close_sockets.c -fPIC -DPIC -o .libs/libcares_la-ares__close_sockets.o
make[1]: Leaving directory `/usr/local/src/c-ares-1.10.0'

root@server1 [/usr/local/src/c-ares-1.10.0]# make install

/usr/bin/install -c -m 644 ares_version.3 ares_inet_pton.3 ares_inet_ntop.3 '/usr/local/share/man/man3'
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 libcares.pc '/usr/local/lib/pkgconfig'
make[1]: Leaving directory `/usr/local/src/c-ares-1.10.0'

Step 3. Now configure CURL with Asynchornous DNS and all other required Protocols.

root@server1 [/usr/local/src/curl-7.46.0]# ./configure --enable-ares=/usr/local/src/c-ares-1.10.0 --enable-http --enable-imap --enable-pop3 --enable-ftp --enable-proxy --enable-tftp --enable-ntlm --enable-static --with-ssl=/usr/local/ssl --enable-ipv6 --enable-shared --disable-ldap --enable-gobher --enable-smtp --with-libidn --disable-rtsp --without-zlib
root@server1 [/usr/local/src/curl-7.46.0]#make
curl version: 7.46.0
Host setup: x86_64-pc-linux-gnu
Install prefix: /usr/local
Compiler: gcc
SSL support: enabled (OpenSSL)
SSH support: no (--with-libssh2)
zlib support: no (--with-zlib)
GSS-API support: no (--with-gssapi)
TLS-SRP support: no (--enable-tls-srp)
resolver: c-ares
IPv6 support: enabled
Unix sockets support: enabled
IDN support: enabled
Build libcurl: Shared=yes, Static=yes
Built-in manual: enabled
--libcurl option: enabled (--disable-libcurl-option)
Verbose errors: enabled (--disable-verbose)
SSPI support: no (--enable-sspi)
ca cert bundle: /etc/pki/tls/certs/ca-bundle.crt
ca cert path: no
LDAP support: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
LDAPS support: no (--enable-ldaps)
RTSP support: no (--enable-rtsp)
RTMP support: no (--with-librtmp)
metalink support: no (--with-libmetalink)
PSL support: no (libpsl not found)
HTTP2 support: disabled (--with-nghttp2)
root@server1 [/usr/local/src/curl-7.46.0]# make install
Making install in lib
make[1]: Entering directory `/usr/local/src/curl-7.46.0/lib'
make[2]: Entering directory `/usr/local/src/curl-7.46.0/lib'
/usr/bin/mkdir -p '/usr/local/lib'
/bin/sh ../libtool --mode=install /usr/bin/install -c '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/ /usr/local/lib/
libtool: install: (cd /usr/local/lib && { ln -s -f || { rm -f && ln -s; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f || { rm -f && ln -s; }; })
libtool: install: /usr/bin/install -c .libs/libcurl.lai /usr/local/lib/
libtool: install: /usr/bin/install -c .libs/libcurl.a /usr/local/lib/libcurl.a
libtool: install: chmod 644 /usr/local/lib/libcurl.a
libtool: install: ranlib /usr/local/lib/libcurl.a
libtool: finish: PATH="/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/sbin" ldconfig -n /usr/local/lib
Libraries have been installed in:

Step 4 . Edit the file /var/cpanel/easy/apache/rawopts/all_php5 to enable custom CURL module with our downloaded latest asynchronous DNS package as below

root@server1 [~]# vim /var/cpanel/easy/apache/rawopts/all_php5

Step 5. Run EasyApache to configure and install the latest CURL package.

root@server1 [~]#/scripts/easyapache

Step 6. Check and confirm the version and settings of the newly installed Curl version.

root@server1 [~]# curl-config --version
libcurl 7.46.0
root@server1 [/usr/local/src/curl-7.46.0]# curl-config --features --protocols
root@server1 [/usr/local/src/curl-7.46.0]# curl --version
curl 7.46.0 (x86_64-pc-linux-gnu) libcurl/7.46.0 OpenSSL/1.0.1e c-ares/1.10.0 libidn/1.28
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL UnixSockets

Now you see our CURL is updated to the latest version available CURL 7.46.0 and it's compiled with Asynchronous DNS to support all the required protocols. You can confirm the compiled curl status with a PHPINFO page.


PHP can be coded to make use of these asynchronous CURL requests to fasten the script execution more efficiently. I hope you find this article useful and informative. I would recommend your valuable comments and suggestions on this. Enjoy!!

4 Comments... add one

    • Considering your request, I've tested the Curl update on an EA4 server. My server was running Curl 7.29v version, I updated it to the latest Curl 7.52v. I've attached the steps followed to update Curl below:

      1. Enabled the CityFan repo

      $rpm -Uvh
      $ cat /etc/yum.repos.d/city-fan.repo
      name=City Fan Repo

      2. Run the following yum commands:

      $yum clean all
      $yum update curl

      It reported an error to enable the package as below:
      Error: Package: (CityFan)
      You could try using --skip-broken to work around the problem
      You could try running: rpm -Va --nofiles --nodigest

      I installed this rpm package manually from the source.

      $rpm -ivh

      3. Re-run the above yum commands to complete.

      $yum update curl. The following packages were installed then.

      Dependencies Resolved

      Package Arch Version Repository Size
      curl x86_64 CityFan 438 k
      Installing for dependencies:
      libmetalink x86_64 0.1.3-1.rhel7 CityFan 25 k
      libpsl x86_64 0.7.0-1.el7 CityFan 45 k
      Updating for dependencies:
      libcurl x86_64 CityFan 394 k
      libssh2 x86_64 CityFan 102 k

      Transaction Summary
      Install ( 2 Dependent packages)
      Upgrade 1 Package (+2 Dependent packages)

      4. Confirmed the Curl version.

      $ curl -V
      curl 7.52.1 (x86_64-redhat-linux-gnu) libcurl/7.52.1 NSS/3.21 Basic ECC zlib/1.2.7 libpsl/0.7.0 (+libicu/50.1.2) libssh2/1.8.0 nghttp2/1.7.1
      Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
      Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy Metalink PSL

      I hope it will be useful for you :). Thank you for your valuable feedback!

  1. Hi Saheetha Shameer, thank you for your article.
    I try to update Curl with your steps above on Centos 7 and I got to step 4.
    When I try to save the edited file I get an error [ Error writing /var/cpanel/easy/apache/rawopts/all_php7y: No such file or directory ]
    Please what should I do next
    I am using CENTOS 7.6 kvm v76.0.20
    Kind regards
    David Imerovic


Leave a Comment