By using this site you agree to the use of cookies.

Learn more

Share via:

Install cURL for PHP in Linux

In case you need to use cURL, this is how you can install it. It also shows how to solve: Call to undefined function curl_init()...

Edited: 2017-03-13 17:08

To install cURL you can type a simple command in the terminal. cURL can be installed with apt-get, so all you would have to do is to type the below in a terminal window:

sudo apt-get install php5-curl

The sudo part of the above gives you the necessary administrative privileges, using apt-get without sudo might result in an error.

After installing cURL you should also restart Apache to make it work.

sudo service apache2 restart

If cURL is not installed

A common error message when cURL is not installed on the server is something like the below:

Call to undefined function curl_init() in blah/blah/blah on line xx

The solution is to install cURL using the terminal, as mentioned in the top of this article.