How to install PHP from source with latest cURL package on Linux?

I simply have to use the latest cURL version (7.21.3) with PHP on my webserver. (Has to do with specific bug fixes)

It is not available by default on most current Linux variant repositories. (Natty Narwhal by Ubuntu is the only one and it's still in beta stages) - so I cannot simply run "aptitude install php5-curl" or similar to get it (the very latest version of cURL) installed.

How would one go about installing the very latest PHP + cURL packages?

Is it as simple as changing the to-download file for cURL in a repository somewhere? (ie. changing a text file's entry somewhere from http://curl.haxx.se/download/curl-7.21.0.tar.gz to http://curl.haxx.se/download/curl-7.21.3.tar.gz or something..?)

Basically I need the very latest cURL library running with PHP on Linux. How would you personally go about doing that?


Solution 1:

Add natty repository:

$sudo echo "deb http://us.archive.ubuntu.com/ubuntu/ natty main universe multiverse" >> /etc/apt/sources.list
$sudo apt-get update

Create /etc/apt/preferences(change lucid, to your release):

Package: *
Pin: release a=natty
Pin-Priority: -10

Package: *
Pin: release a=lucid
Pin-Priority: 900

Install last php5-curl:

$sudo apt-get install -t natty php5-curl

Test(curl_version):

$php -i | grep -i curl
cURL Information => 7.21.3

php -r 'var_dump(curl_version());'

or download php5 and curl source codes and build.