cURL : Enabling [ PHP, Ubuntu ]

To check whether the curl is enabled in your environment, create a php file as below and browse to file know the details.

<?php
echo ‘<pre>’;
var_dump(curl_version());
echo ‘</pre>’;
?>

save as testCurl.php

Fatal error: Call to undefined function curl_version() indicates is not enabled. To enable curl now open you php.ini file and look for this line: extension=php_curl.dll

Remove the semi-colon in front of extension=php_curl.dll

For php 5 , we need not recompile again for curl and curl devel to be included . We could follow the following as ‘raptormanod’ mentions in forum.

Step1. Open terminal and type :sudo synaptic

saffrongeek@saffrongeek-laptop:~$ sudo synaptic

Step2.Search for curl, select All and type ‘curl’ in search box and search. Check the php-curl from the searched list.

Step3.Apply the packages. Then open up your php.ini file at sudo vi /etc/php5/apache2/php.ini
Step4. Add the following line.
extension=php_curl.dll

Step5.Save and restart Apache:
sudo /etc/init.d/apache2 restart
——————————– Terminal————————————

saffrongeek@saffrongeek-laptop:~$ sudo synaptic

saffrongeek@saffrongeek-laptop:~$ sudo vi /etc/php5/apache2/php.ini
saffrongeek@saffrongeek-laptop:~$ restartapache
* Restarting web server apache2                                                                                                                              … waiting

————————————————————————————————-

Advertisements

10 Responses to “cURL : Enabling [ PHP, Ubuntu ]”

  1. Thank you. It worked. Trick is to install all the curl components available from Synaptic manager

  2. Thanks for the little howto saved me from banging my head against the table trying to get my development enviroment online.

  3. Excellent!! Thanx

  4. saffrongeek Says:

    On Ubuntu machine
    $ sudo apt-get install php5-curl

    Since i got two environments mite be my post got a bit of both from memory . On ubuntu run the above command. thats it.

  5. To sort out if php5-curl is installed, you may also just try:

    php -i | grep curl

    It’s quick and you don’t have to switch to from your terminal emulator to your browser and back. 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: