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.

wget https://curl.haxx.se/download/curl-7.67.0.tar.gz
tar xzvf curl-7.67.0.tar.gz
cd curl-7.67.0
./configure
make
make install
[root@test curl-7.67.0]# curl -V
curl 7.67.0 (x86_64-pc-linux-gnu) libcurl/7.67.0 OpenSSL/1.0.2k-fips zlib/1.2.7
Release-Date: 2019-11-06
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL UnixSockets

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

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

tar xzvf php-7.3.12.tar.gz

cd php-7.3.12/ext/curl

/usr/local/lsws/lsphp73/bin/phpize

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

make

make install

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

  • Admin
  • Last modified: 2019/11/29 15:55
  • by Lisa Clarke