[Ubuntu] HowtoaddPHPextensionafterinstalledPHP?

Source: Internet
Author: User
[Ubuntu] HowtoaddPHPextensionafterinstalledPHP? Let say you installed PHP and run it for a month, but now you want to use curl in PHP.

But so bad that you didn't install this extension when you installed PHP. That is to say,

Now you want to add PHP extension.

Here is an example to install curl extension.

Apache2 is in/usr/local/apache2

Php is in/usr/lib/php5/

1. Install the CURL

Download the curl source code from: http://curl.haxx.se/download, here is the curl-7.17.1.tar.gz.

Then uncompress and install it.

Tar-zxf curl-7.17.1.tar.gz
./Configure -- prefix =/usr/local/curl
Sudo make
Sudo make test
Sudo make install

Here we install the curl to/usr/local/curl

2. run the php5-curl

* Note: You shoshould have the php source code, otherwise the steps can't not go on. Assume that the PHP source code

Is in ~ /Downloads/php-5.2.10-src, and you shoshould have installed the phpize.

Cd ~ /Downloads/php-5.2.10-src/ext/curl/
Phpize
./Configure -- with-php-config = php-config -- with-curl =/usr/local/curl
Sudo make
Sudo make test
Sudo make install

Then you will find curl. so in ~ /Downloads/php-5.2.10-src/ext/curl/modules. Copy it to the php extension folder, here is/usr/lib/php5/20060613 + lfs/

Sudo cp ~ /Downloads/php-5.2.10-src/ext/curl/modules/curl. so/usr/lib/php5/20060613 + lfs/curl. so

3. Modify the php. ini file

Add the code to php. ini

Extension = curl. so

4. restart the apache

Sudo/etc/init. d/apache2 restart

Then the curl extension is installed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.