Moodle recommends using libcurl with at least TLS 1.2 support. It's important to upgrade mainly for security reasons, but also because external services (e.g., PayPal) will stop supporting older version of TLS in the near future. There are three terms to be familiar with for this process:
- libcurl - The underlying library that actually carries out the requests (https://curl.haxx.se/libcurl/).
- SSL/TLS libraries - A library that libcurl will be compiled against. This library provides the SSL/TLS functionality in libcurl. Some popular ones are OpenSSL, NSS, and GnuTLS.
- PHP/cURL - The PHP module that wraps libcurl. This module provides the curl_* functions in PHP.
To install the curl library on Unix
- You will need up to date SSL/TLS libraries.
- You will need to compile libcurl
- You will need to recompile PHP/cURL from source
Debian and Debian-based distros
These steps should work on Debian 7.0 (although you may need to install sudo) and Ubuntu 12.04 LTS - if you're using something older you will need to upgrade. Please also note that these steps use the php5-* packages, as that's what many of the package manager repositories use. Ideally you should be using PHP 7.1, or at least PHP 7. More information about that at Moodle and PHP7. If you are using PHP7 or 7.1 it may be possible to substitute the php5-* packages with php7-* or php7.1-* depending on how you installed PHP. This example also uses OpenSSL, but the steps for other libraries are similar.
- Update packages:
sudo apt-get update
- Install the following packages:
apt-get install git build-essential autoconf libtool libtool-bin php5-curl libbison-dev=1:2.5.dfsg-2.1 libxml2-dev libssl-dev openssl
- Check that your OpenSSL version is now at least 1.0.1 by running:
- Get the libcurl sources, compile, and install:
git clone https://github.com/curl/curl.git cd curl git checkout curl-7_51_0 ./buildconf ./configure --with-ssl make sudo make install
- Compile and install the PHP/cURL module
git clone https://github.com/php/php-src.git cd php-src git checkout php-5.6.29 cd ext/curl phpize ./configure make sudo make install sudo bash -c "echo \"extension=curl.so\" > /etc/php5/apache2/conf.d/20-curl.ini" sudo bash -c "echo \"extension=curl.so\" > /etc/php5/cli/conf.d/20-curl.ini"
- Note: The file /etc/php5/[apache2|cli]/conf.d/20-curl.ini may already be present, or be called something slightly different. Check first and modify the command accordingly.
- Restart apache:
sudo service apache2 restart
- Verify the PHP/cURL module is using the updated SSL/TLS libraries:
php -i | grep SSL
- You should see something similar to:
SSL => Yes SSL Version => OpenSSL/1.0.1t
The SSL Version may be different than 1.0.1t, that's fine. Just as long as it's not older than 1.0.1.
To install the curl library on Windows
- Open the php.ini file found in the php/php.ini folder (older versions of XAMPP use moodle/apache/bin folder)
- Find the line:
- Remove the
;at the beginning of the line
- Restart Apache
If you still get an error message after doing these steps, then:
- Go to the php folder.
- Copy the
icuuc##.dllfiles (where ## is a two digit number, for example: 36 or 49).
- Go to the Apache bin directory.
- Paste the three files:
apache/bin/icudt49.dll apache/bin/icuin49.dll apache/bin/icuuc49.dll
- Restart your Apache web server and retry your Moodle install process.
Tip: If it appears that WAMP comes with/has a corrupt curl.dll version, see the forum.wampserver.com thread Wamp Server 2.2 Windows 7 64-bit and curl not working side-by-side configuration incorrect for details of the problem together with a fix.