By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Install cURL for PHP on Ubuntu

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: 2016-01-03 18:28

Maybe you have just finished installing Apache and PHP on Ubuntu, and some of your scripts using cURL won't work. The solution is obviously to install cURL for PHP – to do that, all you have to do is type the below command in the terminal.

sudo apt-get install php5-curl

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

sudo service apache2 restart

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

How to install cURL from terminal

The below video shows how to install cURL as done in this tutorial.