Installing curl. Transferring Web files from the command line. How do I know if I have curl installed?

A small program like curl can do a lot and is unlikely to be installed by default on your VPS server. If you are a web developer and don’t know what curl is, then you should familiarize yourself with its capabilities and, perhaps, some things that were previously difficult to do will now be implemented easier and more efficiently.

Those developers who have ever developed HTML - or XML - parsers know about its capabilities.

I discovered for myself curl only at the moment when it was necessary to develop a plugin for Textpattern, which, contrary to the policy of the social network VKontakte, would automatically add a notification about the publication of a new article to a public group. Unfortunately, I couldn’t do this without curl.

After we, I hope, have decided why we need this curl, we proceed to install it on the server where PHP and Apache are installed. If you have simple hosting (not VPS), then you should contact the hoster with a request to turn it on and he will do everything for you, if he has not already done so. This is exactly what happened to me on one hosting.

How do I know if I have curl installed?

Before rushing to installation, let's check: perhaps you already have it installed. I haven't found anything easier than creating a file, for example, curl.php with content:


and run it through the browser.

In the displayed sheet of text, you can search for curl on the page and if you don’t find it, then you can safely assume that you don’t have it installed.

Installing curl on Debian

Ever since the old days, when I used Ubuntu, I got used to DEB distributions and don’t want to change them. That is why on almost all my servers I use Debian as the operating system, which I have never regretted.

  1. We install everything you need:
    sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
  2. After this, you just need to restart Apache:
    sudo /etc/init.d/apache2 restart

To confirm that curl has started working, we need to run our test file again - curl.php and go through the search for the last time on the open page. In 99% of cases, you will see confirmation that curl is already working and you can start enslaving the Internet.

P.S. Now is the time when it’s already cold outside, and our city administration is in no hurry to turn on the heating. At such moments, salvation can only be found in various heaters. A side effect of any heater is that it greatly dries the surrounding air. Home air humidifiers help combat this. It is these two devices that together will help survive this difficult time for Russia.

I haven't written anything for a long time PHP, so I decided to write a short series of articles dedicated to the magnificent PHP module - cURL. But before you use it, cURL must be installed on Denwer, since in the basic version of this package cURL Excluded.

Before moving on to installing cURL on Denwer, let's briefly talk about the capabilities this module provides. cURL is a convenient way to simulate user actions on the server. In fact, you can check the server's response to a particular request. For example, you can send POST requests and see what the server gives. For example, you want to check the operation of the authorization system. Of course, you can manually enter your username and password through the browser and see what happens. But it will be much more convenient to write a small series of tests in which various examples of login and password are sent, and at the same time a response from the server is displayed: successful authorization or not. And you are already looking at whether the authorization script is working correctly or not. It is used for similar purposes cURL module.

Now let's get busy installing the cURL module on Denwer:

  • Download the extension pack: " PHP5: additional modules" via this link: http://www.denwer.ru/packages/php5.html.
  • Install the downloaded package (first stop the server if it is running).
  • In file " usr/local/php5/php.ini" remove the comment from the line: " ;extension=php_curl.dll", erasing the quotes at the beginning of the line.
  • Start the server.
  • Check the data in phpinfo(). If you see " cURL support enabled", then everything is fine. If not, then carefully check whether you completed all the steps correctly.

I think that in the next article (and maybe one after another), we will analyze this module using the example of using it in PHP scripts, so don't switch!

Brief instructions for those who want to set up curl php on Windows 8.1 x64. If curl is not configured on your web server, the following error occurs: Fatal error: Call to undefined function curl_init().

Setting up cURL

What is written below is relevant for the combination of Windows 8.1 x64, Windows10 x64 + Apache 2.4.12 (win32) + Open SSl 1.0.1m + PHP 5.6.11 (php-5.6.11-Win32-VC11-x86).

  1. Download the cURL library http://winampplugins.co.uk/curl. Unpack it into any folder. For example, "W:\WebServers\usr\local\curl".
  2. In the PHP settings file php.ini, you must enable the extension=php_curl.dll.
  3. This item is not mandatory, but many sources recommend doing it. It works for us without fulfilling this point. From the folder where PHP is installed, copy the following libraries to the “C:\Windows\system32” folder: libssh2.dll, php_curl.dll (located in the ext folder), ssleay32.dll, libeay32.dll. Additionally, the ssleay32.dll file must be copied to “C:\Windows\SysWOW64”.
  4. Add the path to the curl.exe installation folder and the php.ini file to the Path variable in the environment variables. For example, "W:\WebServers\usr\local\curl;W:\WebServers\usr\local\php5". I was very pleased that in windows10 (1511) a new interface for editing environment variables has appeared. It has become very convenient to edit parameters.

Enabling SSL support for cURL

  1. Download the file http://curl.haxx.se/ca/cacert.pem to the folder where the curl.exe library is installed.
  2. Rename the downloaded file to curl-ca-bundle.crt
  3. To restart a computer.

Is a free and open source data transfer tool used for transfer of data to and from a server using the following supported protocols: IMAP, IMAPS, POP, POP3, POP3S, DICT, FILE HTTP, HTTPS, SMB, SMBS, SMTP, SMTPS, FTP, FTPS, TELNET, RTSP, RMTP and TFTP.

During its normal operation, it displays a meter-like progress bar indicating parameters such as data transfer speed, amount of data transferred, and estimated time left. The speed is indicated in bytes per second. Let's see how we can install curl and php-curl in various Linux distributions.

Ubuntu 18.04, 17.10 and Debian 9.3

Login as root and update your Ubuntu system first

Apt-get update

Apt-get install curl

Install php-curl

Apt-get install php-curl

Apt-get install php5.6-curl

Apt-get install php5.5-curl

Verify curl is installed and check its version

From source

Visit curl's website and download the latest curl version by copying the link and using wget command

Uncompress the tarball file using the tar command below

CD curl-7.57.0

You"ll require the C compiler to build the source code. Install the C compiler as shown below.

Apt-get install build-essential

Run the commands below in succession to compile the source code

Centos 7

Login as root and run

Yum install curl

Installing php-curl

Yum install php-curl

From source

Just like we did in Ubuntu 17.10, navigate to curl"s website and download the curl tarball.

Wget https://curl.haxx.se/download/curl-7.57.0.tar.gz

Uncompress the tarball

Tax -xvf curl-7.57.0.tar.gz

Navigate to the uncompressed folder

CD curl-7.57.0

Centos 7 comes already installed with a C compiler. Run the commands below to compile the source code

./configure make make install

Verify installation of curl

Curl --verison

Fedora 27

NOTE Fedora 27 comes pre-installed with curl.

To install php-curl simply log in as root and run

Dnf -y install php-curl

Verify installation of curl

Curl --verison

Arch 2017 Linux

First, log in as root and update the system

Pacman-Sy

Pacman -S curl

Verify whether curl is installed

Pacman -Qi curl

Alpine Linux 3.7

Run apk add curl

Apk add curl

Verify installation of Curl

Apk search curl

Curl is the backbone of internet data transfer for thousands of software applications using a myriad of protocols. Being free and open source has enabled many contributors to work on the curl project and continually come up with newer and improved versions.

Jamie Arthur 3:17 am

About Jamie Arthur

James is a passionate Linux and Windows Systems Administrator with 4 years of experience in Linux, databases and Front-End development. He loves doing research on different Linux distributions and experimenting with installation and configuration of different services and features. His hobbies include swimming, reading novels and playing video games.

21 answers

You may already have a curl

You may not need to download anything:

  • If you're using Windows 10 version 1803 or higher, your OS comes with a copy of curl already configured and ready to use.
  • If you have more esoteric needs (e.g. you need cygwin builds, 3rd party builds, libcurl, header files, sources, etc.), use the curl download wizard. After answering five questions, you will be presented with a list of download links.

    Removing and adjusting curl

    Find curl.exe in your downloaded package; it's probably under bin\ .

    Select a location on your hard drive that will serve as a permanent home for the curls:

    • If you want to make curl its own folder, C:\Program Files\curl\ or C:\curl\ will do.
    • If you have a lot of free executables and don't want to add many separate folders to your PATH, use a single folder for this purpose, such as C:\Program Files\tools\ or C:\tools\ .

    Place curl.exe in the folder. And never move the folder or its contents.

    Then you'll want to make curl available anywhere on the command line. To do this, add the folder to PATH, like this:

    1. Click the Windows 10 Start menu. Start typing "environment."
    2. You will see the search result. Edit system environment variables. Choose this.
    3. The System Properties window opens. Click the button Environment Variables at the bottom.
    4. Select the "Path" variable in the "System Variables" section (bottom field). Click the button Change.
    5. Click " Add" and paste the path to the folder where curl.exe is located.
    6. Click OK, if it is needed. Close any open console windows and reopen them so they get the new PATH .

    Now enjoy typing curl on any command line. Time to have fun!

    To run curl from the command line

    a) Right click on the My Computer icon

    b) Select "Properties"

    d) Go to the [Advanced] tab - "Environment Variables" button

    e) Under "System Variable" select "Path" and "Edit"

    f) Add a semicolon and then the path to where you placed your curl.exe (eg D:\software\curl)

You can now run from the command line by typing:

Curl www.google.com

Starting with Windows 10 version 1803 (and earlier, Insider build 17063), you no longer install curl . Windows contains its own curl.exe (and tar.exe) in C:\Windows\System32\ which you can access directly from regular CMD.

C:\Users\vonc>C:\Windows\System32\curl.exe --version curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL Release-Date: Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL C:\Users\vonc>C:\Windows\System32\tar.exe --version bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f- ipp

It's probably worth noting that Powershell v3 and later contains the Invoke-WebRequest cmdlet, which has some curling capabilities. It's probably worth mentioning the New-WebServiceProxy and Invoke-RestMethod cmdlets as well.

I'm not sure if they will suit you or not, but even though I'm not Windows, I have to say that I find the object-based approach that PS uses much easier to work with utilities like curl, wget, etc. They might be worth a look

You can create the latest version of curl, openssl, libssh2 and zlib in 3 easy steps by following this tutorial.

Curl is built statically, so you don't have to propagate the necessary dynamic runtime.

You can also download the pre-built version (x86 and x64) from

I was looking for the download process Curl and every where they said copy the file curl.exe on System32, but they didn't provide a direct link. so you can enjoy here curl.exe easy to bin folder Just

unzip it and then go to the bin folder where you will get the exe file

I thought I would write exactly what I did (Windows 10, 64-bit version):

Select the curl executable.

Select Win64.

Choose universal.

Choose any one.

curl version: 7.53.1 - SSL enabled SSH enabled. Credit: Victor Shakats. This package is an executable type of curl. This link will get you a pre-compiled curl binary (or in some cases, using the information provided on the page that link takes you to). You may or may not install libcurl as a shared library/DLL. The file is packaged using 7zip. 7zip is a file archiving format.

Click download.

You should have curl-7.53.1-win64-mingw.7z file in your downloads folder.

Install 7-Zip if you don't have it.

Right click, 7-Zip, Extract here. Copy and paste the extracted file somewhere like Z:\Tools\

If you look in the bin folder you will see curl.exe. If you double click on it, the window will quickly flash and disappear. To run it, you need to use the command line. Go to your bin folder and enter curl followed by your options to make the request. You must use double quotes. Single quotes will not work with curl on Windows.

Now you need to add curl to the user Path variable so that you don't have to navigate to the correct folder to run the program. Go to This PC, Computer, System Properties, Advanced System Settings, log in as an administrator (you are not an administrator, right? Right?). Environment Variables, System Variables, look at the list and select Path, then Edit, then New, then e.g.

Z:\Tools\curl-7.53.1-win64-MinGW\Bin

You can add a backslash if you want, I don't think it matters. Press the move up button until it is at the top of the list and you can easily see it from the previous screen. Click OK, OK, OK, then open the command prompt and you can run curl by typing curl from any folder as any user. Don't forget your double quotes.

This is the answer I would like to receive.

This installer made it easy for me http://www.confusedbycode.com/curl/

"You can install cURL for Windows in just a few clicks. Simply download and run the installer from the table below and click Install. The default installation includes.