How to install cURL and Check CURL is enabled or available in Web Server using PHP

Manas Singh 20th Oct 2020

This tutorial will show you how to install cURL and check whether cURL is enabled or not in your web server. cURL is a command line tool for transferring the data from one server to another by accepting multiple types of request.

In another way, cURL (Transfer a URL) is a very lightweight command line tool which handles the HTTP request without sending explicit request from browser.

cURL supports multiple protocol like SMTP, SMTPS, HTTP, HTTPS etc. Most of the web applications are using cURL to handle their API request.

As per Wikipedia, cURL was released on 1997 and the name was httpget, then urlget and now it is cURL. It uses libcurl library which is threadsafe and available in mot of the popular language like C, PHP, JAVA, Python, etc. I have used curl in one of my script Login with Twitter OAuth API Using PHP

How to install cURL

We already learn that most of the modern web servers already supports cURL and it is enabled by default. If not, then you can also install and enable it in any web servers.

Note: If you are using any shared web server like DreamHost, Bluehost, etc then you can contact to your service provider to enable it.

Now without wasting the time, we will see how to install and enable it in multiple distributions of operating system.

Install cURL on Ubuntu

Once you type curl in your Ubuntu terminal and it says 'curl command not found', it means that cURL package is not installed in you Ubuntu.
So this is time to install it in your Ubuntu machine. Simply open the terminal and type the below command:

sudo apt update
sudo apt install curl

After completing the installation, you can verify whether it is installed or not by typing the below command in terminal


Install curl on Fedora/RHEL

It is pre-installed in the latest version of Fedora distribution. cURL is inbuilt from fedora 27 onward. If you still want to install curl for the older version of fedora then run the below command as a root user.

yum install curl

To install php-curl, you can run the below command after login as root.

dnf -y install php-curl

Verify your curl installation in Fedora

curl --verison

Install curl on OpenSUSE

To install curl in OpenSUSE, please run the below command in the terminal

zypper install curl

How to install php-curl

Installing php-curl in PHP 7.0

apt-get install php-curl

Install php-curl in PHP 5.6

apt-get install php5.6-curl

Install php-curl in PHP 5.5

apt-get install php5.5-curl

Now you can verify your installation and check the installed version of curl by running the below command.

curl --verison

How to install CURL in Windows

The installation of curl in windows machine is very simple. You can follow the below steps to enable it.

1. Open your computer C:\ drive and go to C:\wamp\bin\apache\Apache2.2.21\bin directory.

2. Open php.ini file from the above directory.

3. Enable php_curl.dll extension. This can be enabled by removing ';' extension=php_curl.dll

;extension=php_curl.dll to

4. After enabling this extension, you need to restart your server.

To check whether CURL is enable or available on your web server or not. Please make a .php file and write the below code and you can easily check from available extensions.


if (in_array ('curl', get_loaded_extensions())) {

echo "CURL is available on your web server";

} else {
echo "CURL is not available on your web server";

This is a simple method to check whether CURL is enable or not. The another way to check it, Just run phpinfo(); function in your web browser if CURL is enable then a block of CURL will display in your screen and will look like below screenshot:

Advantages of cURL

  1. It supports more protocols like FTP, FTPS, HTTP, HTTPS, SCP, SFTP, etc.
  2. SSL Support: different SSL libraries can call cURL without having any additional effort.
  3. Multipart/form-data can be send using cURL.
  4. cURL also supports gzip compression and Content-Encoding with automatic decompression
  5. The cURL is very compatible with http2
  6. It can handle more chuck of data transfer from one server to another So it can reduce http request timeout problem.
  7. It is more secure than file_get_contents() function.

Authored By Manas Singh

He is a continuous blogger and has blogged on different topic. He loves to surf Internet and always trying to get new Idea about new Technology and Innovations and sharing these great information to all the technology lovers.

Also on DiscussDesk