Install php extension curl in linux

Source: Internet
Author: User
Linux php extension curl installation, [reference] http://blog.csdn.net/qingflyer/article/details/6546071

Method 1

Install cURL

Wget http://curl.haxx.se/download/curl-7.17.1.tar.gz

Tar-zxf curl-7.17.1.tar.gz

./Configure -- prefix =/usr/local/curl

Make & make install

Install php

Just enable the switch -- with-curl =/usr/local/curl

You can.

This extended library is a great alternative to fsockopen and so on.

Method 2

Go to the source code directory for installing the original php,

Cd ext

Cd curl

Phpize

./Configure -- with-curl = DIR

Make & make install

The curl. so file is generated under PHPDIR/ext/curl/moudles.

Copy the curl. so file to the extensions configuration directory and modify php. ini.

Extension = curl. so

The first method tried N times and failed, so it gave up.

Use the second method for installation,

The phpize prompt cannot be found. In fact, the command is under/usr/local/php/bin/target:

#/Usr/local/php/bin/phpize

./Configure -- with-curl = DIR you must specify the php configuration path as follows:

#./Configure -- with-php-config =/usr/local/php/bin/php-config -- with-curl = DIR

Note: In the above information, the -- with-php-config is written as -- with-php-config.

Then compile and install:

# Make
# Make install
Here will prompt the path to generate the file curl. so:/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

Go to this path and copy the curl to the extension_dir Directory (you can view phpinfo in this directory, but you can view php.int directly ),

Modify php. ini

Extension = curl. so

#/Usr/local/php/bin/php-m
If a curl entry is displayed, the operation is successful.

Restart apache

#/Usr/local/apache2/bin/apachectl stop

#/Usr/local/apache2/bin/apachectl start

Now, the CURL item is displayed in phpinfo.

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.