Note: You are currently viewing documentation for Moodle 3.6. Up-to-date documentation for the latest stable version of Moodle is likely available here: admin/environment/php extension/curl.

admin/environment/php extension/curl: Difference between revisions

From MoodleDocs
mNo edit summary
(Update Unix instructions with more detail about TLS 1.2 requirements.)
 
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
To install the curl library on Windows
{{Environment}}
== Unix  ==
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


#Open the ''php.ini'' file found in the ''moodle/apache/bin'' folder
=== Debian and Debian-based distros ===
#Find the line: <code>;extension=php_curl.dll</code>
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 [https://docs.moodle.org/dev/Moodle_and_PHP7 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.
#Remove the <code>;</code> at the beginning of the line
#Restart apache if necessary


* Update packages: <code>sudo apt-get update</code>
* Install the following packages: <code>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</code>
* Check that your OpenSSL version is now at least 1.0.1 by running: <code>openssl version</code>
* 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: <code>sudo service apache2 restart</code>
* Verify the PHP/cURL module is using the updated SSL/TLS libraries: <code>php -i | grep SSL</code>
* You should see something similar to:
  SSL => Yes
  SSL Version => OpenSSL/1.0.1t


To install the curl library on Unix
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.


# You need to recompile PHP from source
== Windows ==
# add '''--with-curl''' to the command line when you run '''configure'''
To install the curl library on Windows


To install the curl library on Ubuntu and Debian
# Open the ''php.ini'' file found in the ''php/php.ini'' folder (older versions of XAMPP use ''moodle/apache/bin'' folder)
# Find the line: <code>;extension=php_curl.dll</code>
# Remove the <code>;</code> at the beginning of the line
# Restart Apache


# aptitude install php5-curl
If you still get an error message after doing these steps, then:
# Restart apache if necessary


* Go to the ''php'' folder.
* Copy the <code>icudt##.dll</code>, <code>icuin##.dll</code> and <code>icuuc##.dll</code> files (where ''##'' is a two digit number, for example: 36 or 49).
* Go to the Apache ''bin'' directory.
* Paste the three files:
  apache/bin/icudt''49''.dll
  apache/bin/icuin''49''.dll
  apache/bin/icuuc''49''.dll
* Restart your Apache web server and retry your Moodle install process.


[[Category:Environment|php extension]]
Tip: If it appears that WAMP comes with/has a corrupt curl.dll version, see the forum.wampserver.com thread [http://forum.wampserver.com/read.php?2,85716,93286 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.
[[Category:MNET]]


[[Category:Environment|PHP extension]]
[[Category:MNet|PHP]]


[[es:admin/environment/php extension/curl]]
[[fr:admin/environment/php extension/curl]]
[[ja:admin/environment/php extension/curl]]
[[ja:admin/environment/php extension/curl]]

Latest revision as of 05:34, 12 December 2016

Unix

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

  1. You will need up to date SSL/TLS libraries.
  2. You will need to compile libcurl
  3. 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: openssl version
  • 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.

Windows

To install the curl library on Windows

  1. Open the php.ini file found in the php/php.ini folder (older versions of XAMPP use moodle/apache/bin folder)
  2. Find the line: ;extension=php_curl.dll
  3. Remove the ; at the beginning of the line
  4. Restart Apache

If you still get an error message after doing these steps, then:

  • Go to the php folder.
  • Copy the icudt##.dll, icuin##.dll and icuuc##.dll files (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.