Table of Contents

How to Compile the cURL PHP Extension

Sometimes the lsphp-curl package does not contain the latest cURL. If this is the case, you can manually compile the cURL extension with the latest version.

The PHPinfo page reveals the currently installed cURL version is 7.29.0, but certain applications may require a higher version in order to work properly.

Install the Latest cURL

rpm -ivh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-3-6.rhel7.noarch.rpm
yum-config-manager --enable city-fan.org
yum clean all
yum update

Check the cURL Version

[root@test ~]# curl -V
curl 7.69.1 (x86_64-redhat-linux-gnu) libcurl/7.69.1 NSS/3.44 zlib/1.2.7 libpsl/0.7.0 (+libicu/50.1.2) libssh2/1.9.0 nghttp2/1.31.1
Release-Date: 2020-03-11
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 GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz Metalink NTLM NTLM_WB PSL SPNEGO SSL UnixSockets

Download the PHP Source Code

In this example, we use PHP 7.4 and compile the extension from source.

wget https://www.php.net/distributions/php-7.4.33.tar.gz

tar xzvf php-7.4.33.tar.gz

cd php-7.4.33/ext/curl

/usr/local/lsws/lsphp74/bin/phpize

./configure --with-php-config=/usr/local/lsws/lsphp74/bin/php-config --with-curl=/usr/bin

make

make install

Restart and Verify

Restart lsphp by command pkill lsphp if necessary, and check the PHPinfo page again.