April 19, 2009 by Ivan
[HowTo] Install Curl in PHP5 and Apache
Ads by Google
This 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
If you found this post usefull please leave me any comment. Thanks, and have a nice day.
Just a quick ‘thank you’ note for this.
I was trying to replace file_get_contents() with curl in some code. Of course it worked on my hosting server but not on my server at home. A quick phpinfo() had shown me the reason why already but your post saved me 15 minutes searching through documentation.
Thank you.
‘Open your terminal and type this command’. It is not clear about what terminal mentioned there. If it said as windows explorer window, so it is ok. But the terminal is confusing most.
maybe to make some illustration or picture of the terminal, or the pathway, how to open this terminal…
Terminal mean your shell. If you’re a linux/unix user, you should familiar with the word “terminal”.
I run the command and I get a lot of 404 errors.
System indicates it needs to install extra packages and upgrade some. When it tries it show the 404 errors.
I have minimal experience on *nix and don’t have a clue what to do.
Can you please suggest a way forward?
Hi Gauti,
Which step produce 404 error?
What OS are you using? Because that command only run on Ubuntu/Debian.
I am using Ubuntu OS.
PHP 5.2.6.2
I get 404′s for many of the PHP5 libraries being upgraded and also the curl libraries. The errors are similar to the ones below –
Err http://security.ubuntu.com intrepid-security/main linux-libc-dev
Err http://security.ubuntu.com intrepid-security/main lib-ssl-dev
Hi Gauti,
looks like your repo is not update.
Try this steps:
1. sudo apt-get autoclean
2. sudo apt-get update
3. sudo apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
Hope this help.
Hi Ivan,
Thanks that sorted the problem out.
thanks dude
sudo apt-get install curl php5-curl
does it for me.
Thanks so much!!
where in my php.ini file should I put line command: extension=curl.so
@henrik,
search your php.ini file with 'extension=' keyword.
You will see bunch of extension command there.
You can add it there.
Cheers.
Ivan,
I am installing an ecommerce package on a new Ubuntu 10.04 server and your instructions worked perfectly.
Many Thanks!
Thanks!
This worked perfectly on Debian 5. I got terrible confused when I was installing magento and it asked for curl..
Many thanks
My Pleasure
great post!!! Very helpful!!
Thanks a lot!
Carolina
worked with me
THANK YOU
You just saved my life….
One other thing: I did not have sudo installed… bummer, but I found this url:
http://www.debianhelp.co.uk/sudo.htm that helped me to install sudo. After that, all your steps were right to the point!
Thanks that was a big help.
Good tutorial,
as I’m new at ubuntu it was very helpful
.
Thank you very much
Very useful to enable a joomla plug-in
Thanks for the tip. Just what I needed for my paypal processing.
hey i need to configure curl for windows but cant…………
hey i need to configure curl for windows but cant…………
i wonder if you using IIS or apache?