Solve the Problem of PHP compiling cURL reinstall the libcurl

Source: Internet
Author: User

Solve the Problem of PHP compiling cURL reinstall the libcurl

Today, we need to use the PHP curl function. We found that the PHP on the server has not configured curl, and then query the official PHP documentation. We learned that the-with-curl parameter is required when compiling PHP, to compile the curl module. Now that PHP has been compiled and installed on the server, I don't want to re-compile it. So I will refer to some comments below to compile the curl module separately and then make install.

First, download the official PHP source code and locate the curl under the extension directory. The extension directory of the old version of PHP may be extensions, and the new version should be ext.

Cd/tmp
Wget http://cn.php.net/get/php-5.3.10.tar.bz2/from/cn2.php.net/mirror
Mv mirror php-5.3.10.tar.bz2
Tar vxf php-5.3.10.tar.bz2
Cd php-5.3.10/ext/curl
Phpize
./Configure
Make install

After the above steps are completed, add extension = curl. so to php. ini, but the following error message is displayed in./configure:

Configure: error: Please reinstall the libcurl distribution-
Easy. h shoshould be in/include/curl/

Basically, determine what package is missing and search for the dependent package that needs to be installed in advance.

# RetHat CentOS or Fedora use the following installation command
Yum install curl-devel
# Debian or Ubuntu use the following installation command
Apt-get install curl
Apt-get install libcurl4-gnutls-dev

However, I found a more convenient method during the search process. In the Debian environment, because my PHP is obtained through apt-get, the same curl can also be obtained through the apt-get command:

Apt-get install curl
Apt-get install php5-curl

Ha ha, it seems that this is much easier to do, so it is installed in this way, the previous method will not consider that, simple, it is best :-)

Finally don't forget to restart php cgi with invoke-rc.d PHP-CGI restart.

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.