Diferencia entre revisiones de «admin/environment/php extension/curl»

De MoodleDocs
(tidy up)
(tidy up)
Línea 2: Línea 2:
{{Pendiente de traducir}}
{{Pendiente de traducir}}
== Unix  ==
== 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:
Moodle recomienda usar libcurl con soporte para al menos TLS 1.2. Es importante actualizar principalmente por motivos de seguridad, pero también porque servicios externos (como por ejemplo, PayPal) dejarán de soportar versiones antiguas de TLS en el futuro cercano. Existen tres términos con los cuales debe familiarizarse para este proceso:


* libcurl - The underlying library that actually carries out the requests (https://curl.haxx.se/libcurl/).
* libcurl - La librería (biblioteca) subyacente que de hecho hace las solicitudes (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.
* Librerías (bibliotecas)  SSL/TLS - UNa librerpia contra la cual será compilada libcurl. Esta librería proporciona la funcionalidad SSL/TLS en libcurl. Algunas opciones populares son OpenSSL, NSS, y GnuTLS.
* PHP/cURL - The PHP module that wraps libcurl. This module provides the curl_* functions in PHP.
* PHP/cURL - El módulo de [[PHP]] que envuelve a libcurl. Este módulo proporciona las funciones curl_* en PHP.


To install the curl library on Unix
Para instalar la librería curl en Unix


# You will need up to date SSL/TLS libraries.
# Usted necesitará librerpias SSL/TLS actualizadas.
# You will need to compile libcurl
# Usted necesitará compilar libcurl
# You will need to recompile PHP/cURL from source
# Usted necesitará recompilar  PHP/cURL desde el código fuente


=== Debian and Debian-based distros ===
=== Distribuciones Debian y basadas en Debian (Ubuntu,...) ===
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.
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.


* Update packages: <code>sudo apt-get update</code>
* Actualizar paquetes: <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>
* Instalar los siguientes paquetes: <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>
* Revisar que su versión OpenSSL sea ahora al menos 1.0.1 corriendo: <code>openssl version</code>
* Get the libcurl sources, compile, and install:
* Obtener los códigos fuentes de libcurl, compilar, e instalar:
   git clone https://github.com/curl/curl.git
   git clone https://github.com/curl/curl.git
   cd curl
   cd curl
Línea 28: Línea 28:
   make
   make
   sudo make install
   sudo make install
* Compile and install the PHP/cURL module
* Compilar e instalar el módulo PHP/cURL  
   git clone https://github.com/php/php-src.git
   git clone https://github.com/php/php-src.git
   cd php-src
   cd php-src
Línea 39: Línea 39:
   sudo bash -c "echo \"extension=curl.so\" > /etc/php5/apache2/conf.d/20-curl.ini"
   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"
   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.
* '''Nota:''' El archivo /etc/php5/[apache2|cli]/conf.d/20-curl.ini podría ya estar presente, ollamarse de una forma ligeramente diferente. Revise primeramente y modifique el comando apropiadamente.
* Restart apache: <code>sudo service apache2 restart</code>
* Reinicet 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>
* Verifique que el módulo PHP/cURL esté usando las librerías actualizadas SSL/TLS: <code>php -i | grep SSL</code>
* You should see something similar to:
* Usted debería ver algo similar a :
   SSL => Yes
   SSL => Yes
   SSL Version => OpenSSL/1.0.1t
   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.
LA versión de SSL podría ser diferente de 1.0.1t, lo que está bien, siempre y cuando no sea más antigua que 1.0.1.


== Windows ==
== Windows ==
To install the curl library on Windows
Para instalar la librería curl en Windows


# Open the ''php.ini'' file found in the ''php/php.ini'' folder (older versions of XAMPP use ''moodle/apache/bin'' folder)  
# Abra el archivo ''php.ini'' encontrado en la carpeta ''php/php.ini'' (versiones más antiguas de XAMPP usan la carpeta ''moodle/apache/bin'' )  
# Find the line: <code>;extension=php_curl.dll</code>
# Encontrar la línea: <code>;extension=php_curl.dll</code>
# Remove the <code>;</code> at the beginning of the line
# Quitar el caracter  <code>;</code> al principio de la línea
# Restart Apache
# Reiniciar Apache


If you still get an error message after doing these steps, then:
Si continúa obteniendo un mensaje de error después de realizar estos pasos, entonces:


* Go to the ''php'' folder.
* Vaya a la carpeta ''php'' .
* 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).
* Copie el archivo <code>icudt##.dll</code>, <code>icuin##.dll</code> <code>icuuc##.dll</code> (donde ''##'' es un número de dos dígitos, como por ejemplo: 36 o 49).
* Go to the Apache ''bin'' directory.
* Vaya al directorio ''bin'' de Apache.
* Paste the three files:
* Pegue allí los siguientes tres archivos:
   apache/bin/icudt''49''.dll
   apache/bin/icudt''49''.dll
   apache/bin/icuin''49''.dll
   apache/bin/icuin''49''.dll
   apache/bin/icuuc''49''.dll
   apache/bin/icuuc''49''.dll
* Restart your Apache web server and retry your Moodle install process.
* Reinicie su servidor web Apache y vuelva a intentar el proceso de instalación de Moodle.


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.
Sugerencia: Si pareciera que WAMP tiene o viene con una versión corrupta de curl.dll, vea el hilo del foro forum.wampserver.com [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] para los detalles del problema y como resolverlo.


[[Categoría:Entorno|PHP extension]]
[[Categoría:Entorno|PHP extension]]

Revisión del 14:32 21 ene 2018

Nota: Pendiente de Traducir. ¡Anímese a traducir esta página!.     ( y otras páginas pendientes)

Unix

Moodle recomienda usar libcurl con soporte para al menos TLS 1.2. Es importante actualizar principalmente por motivos de seguridad, pero también porque servicios externos (como por ejemplo, PayPal) dejarán de soportar versiones antiguas de TLS en el futuro cercano. Existen tres términos con los cuales debe familiarizarse para este proceso:

  • libcurl - La librería (biblioteca) subyacente que de hecho hace las solicitudes (https://curl.haxx.se/libcurl/).
  • Librerías (bibliotecas) SSL/TLS - UNa librerpia contra la cual será compilada libcurl. Esta librería proporciona la funcionalidad SSL/TLS en libcurl. Algunas opciones populares son OpenSSL, NSS, y GnuTLS.
  • PHP/cURL - El módulo de PHP que envuelve a libcurl. Este módulo proporciona las funciones curl_* en PHP.

Para instalar la librería curl en Unix

  1. Usted necesitará librerpias SSL/TLS actualizadas.
  2. Usted necesitará compilar libcurl
  3. Usted necesitará recompilar PHP/cURL desde el código fuente

Distribuciones Debian y basadas en Debian (Ubuntu,...)

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.

  • Actualizar paquetes: sudo apt-get update
  • Instalar los siguientes paquetes: 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
  • Revisar que su versión OpenSSL sea ahora al menos 1.0.1 corriendo: openssl version
  • Obtener los códigos fuentes de libcurl, compilar, e instalar:
 git clone https://github.com/curl/curl.git
 cd curl
 git checkout curl-7_51_0
 ./buildconf
 ./configure --with-ssl
 make
 sudo make install
  • Compilar e instalar el módulo PHP/cURL
 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"
  • Nota: El archivo /etc/php5/[apache2|cli]/conf.d/20-curl.ini podría ya estar presente, ollamarse de una forma ligeramente diferente. Revise primeramente y modifique el comando apropiadamente.
  • Reinicet apache: sudo service apache2 restart
  • Verifique que el módulo PHP/cURL esté usando las librerías actualizadas SSL/TLS: php -i | grep SSL
  • Usted debería ver algo similar a :
 SSL => Yes
 SSL Version => OpenSSL/1.0.1t

LA versión de SSL podría ser diferente de 1.0.1t, lo que está bien, siempre y cuando no sea más antigua que 1.0.1.

Windows

Para instalar la librería curl en Windows

  1. Abra el archivo php.ini encontrado en la carpeta php/php.ini (versiones más antiguas de XAMPP usan la carpeta moodle/apache/bin )
  2. Encontrar la línea: ;extension=php_curl.dll
  3. Quitar el caracter ; al principio de la línea
  4. Reiniciar Apache

Si continúa obteniendo un mensaje de error después de realizar estos pasos, entonces:

  • Vaya a la carpeta php .
  • Copie el archivo icudt##.dll, icuin##.dll y icuuc##.dll (donde ## es un número de dos dígitos, como por ejemplo: 36 o 49).
  • Vaya al directorio bin de Apache.
  • Pegue allí los siguientes tres archivos:
  apache/bin/icudt49.dll
  apache/bin/icuin49.dll
  apache/bin/icuuc49.dll
  • Reinicie su servidor web Apache y vuelva a intentar el proceso de instalación de Moodle.

Sugerencia: Si pareciera que WAMP tiene o viene con una versión corrupta de curl.dll, vea el hilo del foro forum.wampserver.com Wamp Server 2.2 Windows 7 64-bit and curl not working side-by-side configuration incorrect para los detalles del problema y como resolverlo.