206

I currently have PHP 5.3 installed with Apache in 10.04 Lucid. How can I add the PHP Curl libraries? Do I need to install any other dependencies for curl?

1
  • I wonder why there is no answer showing how to compile the extension when you want a custom version.
    – Daniel W.
    Nov 3, 2016 at 15:43

7 Answers 7

297

I believe that the package php5-curl should do the trick. Use the package manager of your choice and the deps should be taken care of.

sudo apt-get install php5-curl

You will need to restart the server afterwards:

sudo service apache2 restart

Alternatively, if you are using php-fpm, you'll need to restart php5-fpm instead

sudo service php5-fpm restart
6
  • 1
    It's perfectly fine asking here, but next time make sure to search the Software Center to save you some time ;) Feb 22, 2011 at 11:06
  • This is on a server I'm managing from the CLI, what is the Software Center? Feb 22, 2011 at 12:22
  • 4
    @DarrenNewton The CLI equivalent would probably apt-cache search btw.
    – Nanne
    Dec 16, 2012 at 10:03
  • 1
    @xav0989, it seems like this is a bug upstream, as on Debian it only reloads apache's config. It should restart apache.
    – d-_-b
    Aug 23, 2013 at 0:37
  • 2
    On Ubuntu 16.04 $ sudo apt-get install php5.6-curl Sep 1, 2016 at 18:39
12

For the subversion php5.6 use the following command (tested for Ubuntu 14.04):

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.6
php — version
sudo apt-get install php5.6-curl
5
7

My conf: Ubuntu 11.10, already installed mysql,php5 and apache2, before installing php5-curl in terminal I did:

edit sources list like:

sudo -H gedit /etc/apt/sources.list

you can check your configuration in http://repogen.simplylinux.ch/

Next command:

apt-get install aptitude

Next command:

aptitude install php5-curl

You get something like this:

The following NEW packages will be installed:
php5-curl{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 27.1 kB of archives. After unpacking 127 kB will be used.
The following packages have unmet dependencies:
php5-curl: Depends: php5-common (= 5.3.6-13ubuntu3.1) but 5.3.6-13ubuntu3.8 is installed.
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1)     php5-curl [Not Installed]                          

Accept this solution? [Y/n/q/?] n

Your answer here is n

Next lines print out:

The following actions will resolve these dependencies:

Downgrade the following packages:                                             
1)     libapache2-mod-php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]
2)     php5 [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]               
3)     php5-cli [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]           
4)     php5-common [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]        
5)     php5-gd [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]            
6)     php5-mysql [5.3.6-13ubuntu3.8 (now) -> 5.3.6-13ubuntu3.1 (oneiric)]         

Accept this solution? [Y/n/q/?] y

Your answer here is y.

In your browser open phpinfo(), check property:

extension_dir   /usr/lib/php5/20090626+lfs

In that folder you should now have curl.so

Edit php.ini

nano /etc/php5/apache2/php.ini

find "dynamic extensions" add code below:

extension=curl.so

After that restart apache2 and check phpinfo(), curl must be enabled

5

full solution for install LAMP and cURL extension:

sudo apt-get update
sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

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

and then:

cd /etc/php5/apache2/

sudo nano php.ini

add this command: extension=curl.so

the last thing restart apache

4

You need to install the php5-curl package.

sudo apt-get install php5-curl
2

Run following command

sudo apt-get install curl libcurl3 libcurl3-dev php5-mcrypt php5-curl
1
  • 1
    What does php5-mcrypt have with this?
    – Starx
    Mar 23, 2016 at 13:43
1

For php 5.6 this will do the trick:

sudo apt-get install php5.6-curl

sudo service apache2 restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .