April 19, 2009 by  

[HowTo] Install Curl in PHP5 and Apache

PHP LogoThis time i want to share with you how to install Curl in PHP5 in Linux Environtment (I’m using Ubuntu 8.10) and using apache web server, but if you have any question to install php-curl in other environment, feel free to contact me of leave any comment, i will glad to help you.

Okay, now let’s start with check if php-curl is already installed in your server or not. To check it please follow this step:

1. Create a file in your web server (in Ubuntu it would be in /var/www folder), name it info.php
2. Open that file and type this command:

<?php phpinfo(); ?>

3.  Save that file
4. Open your favorite browser and open that file (ex: http://localhost/info.php)
5. Now you will see the Information about your PHP installation
6. Search for Curl, and if you cannot find it, it mean your php doesn’t have curl installed.

To install php-curl please follow this steps:
1. Open your terminal and type this command:

sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt

2. After it finish open php.ini file (mine is at /etc/php5/apache2/php.ini ) and add this command: extension=curl.so

3. Save the file and restart apache with this command:

/etc/init.d/apache2 restart

4. Check the PHP information page again, you will find PHP-CURL installed
5. That’s it

Most hosting providers todays already have Curl installed on their server. Just in case you confuse which hosting provider are good to host your websites and have no downtime since i use it, you can try to look at Hawkhost. Thanks.

What people search:

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
website promotion ahmedabad 5 pts

wow awesome details If any one want any kind of gas producers just contact me.. for more details just simply click on top

Mineral Water Plant 11 pts

I think this is an informative post and it is very useful and knowledgeable, great post.

ptfe cartridges 6 pts

I think this is an useful publish and it is very useful and knowledgeable, fantastic publish.

Organic SEO Services 11 pts

Thanks for sharing this useful tips.

Law Website Design 56 pts

Nice way to explain. I really like it.

michelwilliams 5 pts

Small bits of content which are explained in details, helps me understand the topic, thank you!

http://topclassifiedsoftware.com

Been doing everything from building php and libcurl from source, configuring php with the separately built curl module.... But couldn't make my apache server point to this newly-built php-bundle. But your two lines of instructions did the job! Thanks man! Thanks a lot!

Please enter a valid URL. Protocol is required (http://, https:// or ftp://)

Thank you, works fine on Debian Lenny!

For ubuntu server 11.04, the following works:

sudo apt-get install curl php5-curl

sudo /etc/init.d/apache2 restart

@bd123731de183ad12418f24a53a579b9:disqus -- Thanks :-)

Great... thanks!

i m using wamp server in windows but in my php curl is not present so how can i install for windows curl?

Are you using XAMPP? or you just install everything manually?

Beautiful! I was looking for just thing. Apt-get makes it so easy!
Thanks so much.

Thank you very much, this article was useful for me

Veeery usefull, thanks for your valuable time.

Great Buddy, tanQ for this valuable information...now itz easy 4 me .

Thank you very much, easy to understand and works like a charm :)

Where do we type the command you mentioned? Do we do it in DOS?

No this article is for Ubuntu or Linux only. For Windows use xampp http://www.ivankristianto.com/web-development/server/local-server-for-testing-environment-with-xampp-on-windows/1566/ it's all there.

Very useful thank you...

sudo aptitude install php5-curl

works for me.

I want to install Curl into windows environment so please help me

thanks
for those trying to install lately with ubuntu and didn't work with them, try first
sudo apt-get install curl php5-curl
in many cases this will be enough, if not, then proceed with the line in the article above it should run with no errors now.

it seems to me a broken dependency

Great.. thanks! this worked for me..

works fine, thx & merry christmas *<(:)-{)>

Hi,
Just want to ask I follow the steps that you have.. but still i haven't install the cURL in my localhost it prompt me the below error.

Reading package lists... Done
Building dependency tree
Reading state information... Done
libcurl3 is already the newest version.
Package libcurl3-dev is a virtual package provided by:
libcurl4-openssl-dev 7.18.0-1ubuntu2.2
You should explicitly select one to install.
E: Package libcurl3-dev has no installation candidate

Please help I need this to install on my PC for testing purposes..
thanks.

update your repository. What ubuntu version are you using?

THX !

Still a few issues I had to run " /etc/init.d/apache2 restart " with sudo (as a super user aka root)
and the edit of "php.ini" was done using " sudo gedit php.ini " or directly using "sudo gedit /etc/php5/apache2/php.ini "

THX !

Thanks a lot for this easy to use config page!!

Greetings from Sweden

Thanks... that's helpful. Another easy way is to install it using Ubuntu Software Center...

Hey!

Thanks a lot for the help. I needed to enable curl for the Wordpress Stats Dashboard.

Worked perfectly for me .. thanks a ton.

Thanks alot, this saved me with installation of SugarCRm which needed the curl module enabled.

Hi,

I am getting the following error, kindly help.

--------------
]# sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
sudo: apt-get: command not found
---------------

Thanks,
AS

that command only for ubuntu and debian. if you are using centos, fedora or RHEL use yum instead

Hi, this was very usfull. Thank you, you saved me a lot of time!
Kind Regards

I LOVE YOU. YOU HAVE SAVED ME FROM JUMPING IN FRONT OF A TRUCK. I WAS ABOUT TO TAKE THIS COMPUTER AND THROW IT OUT THE WINDOW

Hi Ivan
Nice page,
I try to develop a facebook aplication in a free hosting but it shows "Facebook needs the CURL PHP extension." what can be? thanks

You need to install curl in your web server before it can connect to Facebook.

i will lick to no more about the terminal commands and there are mining tans to u.. i hope to here if u... my name is lamptey from ghana email:latifani2@yahoo.com

Terimakasih! I got some errors on restarting apache, but it seems to be working fine.

Thank you very much! You help a lot.