How do I install curl in php5?

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

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

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

Tags:

Php