Install PHP extension curl in CentOs

Source: Internet
Author: User
Tags zts

After the server runs for a period of time, it may suddenly need to add an extension, such as curl, pdo, and xmlrpc. This requires you to add the extension independently without re-compiling Linux PHP.


1. Install crul

Wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
Tar-zxvf curl-7.19.6.tar.gz
Cd curl-7.19.6
./Configure -- prefix =/usr/local/curl
Make
Make install
2. Linux PHP compilation and generation Extension

Go to the ext directory in the Linux PHP source code directory, where the source code of each extension module is stored. Select the required module, such as the curl module: cd curl, and run phpize to generate the compilation file, phpize may report the following error when running/usr/local/php5/bin/phpize in the bin directory of the PHP installation directory: Cannot find autoconf. please check your autoconf installation and the $ PHP_AUTOCONF, environment variable is set correctly and then rerun this script. ", you need to install autoconf: yum install autoconf (RedHat or CentOS), apt-get install autoconf (Ubuntu Linux)

Generate a configuration file and compile and generate a module for Linux PHP:

/Usr/local/php5/bin/phpize
./Configure -- with-curl =/usr/local/curl -- with-php-config =/usr/local/php5/bin/php-config
Make
Make install
In this way, curl. so is copied to the corresponding PHP Directory (such as:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626 /)

Added

 
 

3. modify the configuration in Linux PHP

In Linux PHP. in ini, set the extension Directory: extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/" and add extension module reference: extension = curl. so

You do not need to specify the extension directory here. the default extension directory of INI is/usr/local/php5/lib/php/extensions. so add extension = curl to CP here. so.

4. Check and restart Apache
When executing this command in/usr/local/php/bin/php-v, Linux PHP checks whether the configuration file is correct. If any configuration error occurs, an error is returned, you can troubleshoot the same issue based on the error information.

 
 

 

Follow these steps to install other extensions.



Author fenyi0

Related Article

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.