How to Install Curl on Windows

How do I install and use cURL on Windows?

Assuming you got it from https://curl.haxx.se/download.html, just unzip it wherever you want. No need to install. If you are going to use SSL, you need to download the OpenSSL DLLs, available from curl's website.

Run cURL commands from Windows console

If you are not into Cygwin, you can use native Windows builds. Some are here: curl Download Wizard.

Enable cURL in Windows 10

Here is the steps to enable curl on Windows :

...
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "C:\PathToMyPhp\ext"

...

extension=php_curl.dll

...

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = C:\PathToMyFile\cacert.pem

1 - Make sure your extension_dir point to the php extension directory.

2 - uncomment or add the extension .dll name .

Here is the right syntax by convention for php extensions : php_nameOfTheExtension.dll

The .dll are placed in the extension directory of php or you must place it here in case of 3rd party download.

3 - cacert.pem is optional and is used for SSL transactions.

Download here : https://curl.haxx.se/docs/caextract.html

4 - Check with phpinfo() if curl is in the list and check the configuration.

5 - In case of error, check the error.log and access.log of Apache

Edit 1 :

6 - I forgot : add the paths of your php directory to the Windows Environment PATH Variable for .dll dependencies.

Question/Response here :
Enable CURL on Windows For PHP5.6.4

Edit 2 :
Here is the path for the files :

Depending on MySQL installation & version

C:\Program Files\MySQL\MySQL Server 8.0\bin\libeay32.dll

C:\Program Files\MySQL\MySQL Server 8.0\bin\ssleay32.dll

Depending on your php directory

C:\php7\libssh2.dll

Edit 3 :

Example of extensions configuration with the right syntax taken from PHP5 but working also for PHP7 :

; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
;extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_odbc.dll
extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll

; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=php_snmp.dll

;extension=php_soap.dll
extension=php_sockets.dll
extension=php_sqlite3.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
extension=php_xsl.dll

zend_extension="C:\php-7.1.22\ext\php_opcache.dll"
zend_extension="C:\php-7.1.22\ext\php_xdebug-2.6.1-7.1-vc14-x86_64.dll"

Hope this will help.

Cannot Install cURL on Windows 7 (64-bit) Library Issues

I have found the answer. It seems you cannot request data from your curl command if it has not been first sanitized (my requests contained ":" and "/"). The data needs to be sanitized first using the "data-urlencode" switch.

For example, if I try to run the following command:

curl http://localhost:3000/posts --data 'title=test'

There isn't any issue. However, if I try to pass the website that came from the link textfield in the form:

curl http://localhost:3000/posts --data 'title=test&link=http://test.com'

I will receive the following error (in Windows command prompt):

'link' is not recognized as an internal or external command, operable program or batch file.

Even if I tried with just 'dots':

curl http://localhost:3000/posts --data 'title=test&link=www.test.com'

I will receive the following error (in Windows command prompt):

curl: (6) Could not resolve host: 'link=www.test.com'

My solution was to curl the following:

curl http://localhost:3000/posts --data 'title=test' --data-urlencode 'link=http://www.test.com'

And it was curled successfully.

Initial idea provided on this page as the second answer:

Testing REST routes with curl --data, returns 404

Cannot install curl on Windows 7

I actually downloaded it. There is a curl.exe file in the src folder. The path would be src/curl.exe.

How do I install cURL on Windows?

You're probably mistaking what PHP.ini you need to edit. first, add a PHPinfo(); to a info.php, and run it from your browser.

Write down the PHP ini directory path you see in the variables list now!
You will probably notice that it's different from your PHP-CLI ini file.

Enable the extension

You're done :-)

error on installing curl on windows 10

I think you have a misunderstand here. The file you mentioned is containing the sourcecode of curl. So you can't run it directly, you first would have to compile it.

While compiling on your own might have advantages what you are probably searching for is a precompiled binary. These binaries are provided for several platforms and are linked further down the download page.

For Windows you will find these:

CURL for Windows download links

Current versions are highlighted in yellow. Depending on your requirements you can choose from a plethora of archives.
Probably a safe bet with maximum functionality and least dependencies is the Win32 Generic binary which includes SSL and SSH.



Related Topics



Leave a reply



Submit