Install Curl for PHP in Ubuntu

Default featured post

If you get similar error message like Fatal error: Call to undefined function curl_init(), means that your Curl lib/module is not installed for PHP. Fortunately, in Ubuntu installing Curl for PHP just requires two commands and it can be done so easily with the help of apt-get package installation.

The process of installing Curl is two steps. In the first step you need to install the library itself and in the second step restart Apache. This step sometimes is missed in some documentation and it makes novice programmer like me so confused.

Now, for installing Curl for PHP in Ubuntu types the following command,

$ sudo apt-get install php5-curl

After that, you need to restart your Apache web server which is quite easy like the below command,

$ sudo /etc/init.d/apache2 restart

After that if everything went well, you should have Curl installed and functional.