phpday 2025 - Call For Papers

Installation

Pour utiliser cURL depuis les scripts PHP, vous devez compiler celui-ci avec l'option --with-curl[=DIR] où DIR est le chemin jusqu'au dossier contenant les dossiers lib et include. Dans le dossier include, il doit se trouver un dossier appelé curl, qui contient notamment les fichiers easy.h et curl.h. Il doit aussi se trouver un fichier nommé libcurl.a dans le dossier lib.

Note: Note aux utilisateurs Win32
Afin d'activer ce module dans l'environnement Windows, libeay32.dll et ssleay32.dll, ou, depuis OpenSSL 1.1 libcrypto-*.dll et libssl-*.dll, doivent être présents dans votre PATH. libssh2.dll doit aussi être présent dans votre PATH. Vous n'avez pas besoin de libcurl.dll du site cURL.

add a note

User Contributed Notes 14 notes

up
24
comments at adstation-systems dot com
16 years ago
You may be confused, as I was, by the instructions for installing cURL in php. The instruction "To use PHP's cURL support you must also compile PHP --with-curl[=DIR]..." was murky to me, since I didn't compile php when I installed it. I just copied all of the necessary files to the correct folders as described very clearly in the php manual.

I am using Windows XP and Apache with php 5.1.6. In this situation, and it may apply to php versions of 5.0 and later, all one needs to do is remove the ";" from the front of the directive extension=php_curl.dll. You should also check to make certain that libeay32.dll and ssleay32.dll are in your php directory with the other dll's. This directory should already be in you path, so the instruction to put them in you path is not critical.

You can then run phpinfo() and you should see a heading for curl in the listing.

Succinctly, my installation of cURL consisted of removing the semi-colon in front of the ;extension=php_curl.dll line in php.ini, saving php.ini and restarting Apache. You may wish to try this if you are using php 5.0 and later and are having difficulty understanding the instructions on the cURL installation page at php.net

You might also find the information at http://curl.phptrack.com/forum/viewtopic.php?t=52 useful.
up
17
Developtus.com
9 years ago
Upgrading to php 5.6.9 on Windows 7 x64 curl no longer is recognised. No errors on server start package just not available and didn't show in phpinfo.php. deplister.exe was ok
I fixed coping the following list files from php folder (in my case D:\xampp\php)
libeay32.dll
libssh2.dll
ssleay32.dll
to c:\xampp\apache\bin (or your apache\bin path), restart apache and works fine, apache's libraries were outdated
up
15
Joseph Marlin
13 years ago
Ubuntu 11.04

I already had Apache and PHP5 setup, but simply adding php5-curl and curl did *not* work. I also had to get libcurl3 and libcurl3-dev. The full command:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

You'll know if it works because phpinfo() will get a new section with Curl info.
up
9
epos_jk
7 years ago
You dont need to copy files to use PHP CURL with Apache 2.4 - use the LoadFile directive in your apache config file instead:
LoadFile "C:/php7/libssh2.dll"
(that was all it took for me to get it work)
up
8
epos_jk
7 years ago
Beginning with version 1.1.0 OpenSSL did change their libary names!
libeay32.dll is now libcrypto-*.dll (e.g. libcrypto-1_1-x64.dll for OpenSSL 1.1.x on 64bit windows)
ssleay32.dll is now libssl-*.dll (e.g. libssl-1_1-x64.dll for OpenSSL 1.1.x on 64bit windows)
up
5
TristanV
10 years ago
If you are running on Windows with a Wampserver or alike preconfigured PHP, if you did everything that was advised (path is correct, dlls are in the System32 or the Wow64 folder, php_curl extension uncommented in the php.ini, rebooted your machine and restarted your services), and you still receive messages saying that curl is not installed :
- maybe you are running a command line script (and not a curl instruction within a web application). If yes, remember that there are 2 distinct php.ini configuration files : one for the php-cli commands (run php at command line) and one for the php instructions (run from a page in your www folder).
Wampserver's menuitem "php.ini" only opens the webserver's php.ini, not the php-cli one.
So it will be great to check your php-cli's php.ini configuration file ! (you'll find it in the php.exe's installation folder)
You need to uncomment the extension php_curl in this php.ini file for the command lines to work with curl.
Also uncomment the php_openssl extention by the way (often used with curl).
I hope this fixed issue will help someone else :)
up
5
jorijnsmit at gmail dot com
10 years ago
It is not necessary to always (re)compile PHP. For me it was sufficient to install php5-curl and restart Apache:

$ sudo apt-get install php5-curl
$ sudo /etc/init.d/apache2 restart
up
5
regs at voidship dot net
16 years ago
If you're dense like I am, spare yourself the trouble on an Ubuntu system (probably Debian too) and...

$ sudo apt-get install php5-curl

Then feel dumb, but not as dumb as me.
up
1
anonymous
6 years ago
Upgrading to php 7.1.6 on Apache 2.4 32bit version Windows 7 x64

this curl implementation works:

1. C:/(path to php folder)/php.ini
enable extension=php_curl.dll

libeay32.dll, ssleay32.dll, libssh2.dll find directly in php7 folder

2. add this to Apache/conf/httpd.conf
# load curl and open ssl libraries
LoadFile "C:/(path to php folder)/libeay32.dll"
LoadFile "C:/(path to php folder)/ssleay32.dll"
LoadFile "C:/(path to php folder)/libssh2.dll"
up
0
Greg
4 years ago
For those who may be having WordPress issues relating to curl, the answer for me was that the curl.cainfo wasn't specified in the config. This resulted in a plugin giving some non-graceful errors for which I was finally able to track it down.

curl.cainfo = "C:\php\extras\ssl\cacert.pem"

You'll need a copy of the cacert.pem (doesn't come with PHP and does need to be updated every so often can be found at an official permalink of:
https://curl.haxx.se/ca/cacert.pem

They use a modified version of Mozilla's certificate store meant to work with libcurl.

I'm not an expert, this is just what fixed the errors for me.

(cacert.pem lists official root certificate providers so your computer knows which ones its safe to authenticate against is my lay interpretation. I'm sure it's not technically accurate but close enough for us lay people.)
up
-2
NV
2 years ago
If trying to get installed on Windows (I was using Windows 10, Apache 2.4, PHP 8.1) and the curl module isn't loading and PHP is showing/logging the following error but <phpPath>\ext\php_curl.dll does exist:

[14-Apr-2022 23:41:36 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: <phpPath>\ext\curl (The specified module could not be found), <phpPath>\ext\php_curl.dll (The specified module could not be found)) in Unknown on line 0

The problem is not that it can't find the module but that it can't find its dependencies (ie <phpPath>\libcrypto-1.1.dll and libssl-1.1.dll or similar). As described in other comments, you need to add <phpPath> to the Systerm Variables, PATH variable.

But, if you are starting Apache as a service, the default is for the service to run under the Local System account. In that case, ****YOU NEED TO REBOOT**** for the change in the PATH variable to be updated for the Local System account (see the following for reference:
https://stackoverflow.com/questions/32068893/how-to-change-path-value-for-local-system-account-in-ms-windows)
up
-3
wixelbomb at yahoo dot com
14 years ago
Just an additional note for Windows XP installations ...

The instructions others have courteously given still lack one small item for those who have the Windows/system32 directory as the repository for the .dll files concerned with php_curl.

Go to the ext directory of your php installation and copy php_curl.dll to the Windows/system32 folder after you have followed the advise given elsewhere.

So ...
1) remove ';' from extension=php_curl.dll in php.ini
2) ensure that ssleay32.dll and libeay32.dll are in Windows/system32.
3) Copy php_curl.dll into Windows\System32 as well.

G'day

bearstate
up
-3
karliskavacis at gmail dot com
8 years ago
In my case, while running Windows 10 and Apache Httpd 2.4, I had to add my PHP7 root directory to Windows PATH and it resolved issues with failing to load couple of PHP extensions.
up
-3
1004707812 at qq dot com
6 years ago
Win10 64bit, php7 x64,apache x64
It's important to set " extension_dir = "X:/WAMP/php/ext" " clearly in php.ini .
Remember some names of dll has changed recently, specially in the x64 environment.
To Top