Home  >  Article  >  Backend Development  >  Two ways to add CURL extension library to PHP

Two ways to add CURL extension library to PHP

WBOY
WBOYOriginal
2016-07-25 08:56:191339browse
  1. wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
  2. tar -zxvf curl-7.19.6.tar.gz
  3. cd curl-7.19.6
  4. ./ configure --prefix=/usr/local/curl
  5. make
  6. make install
Copy the code

2, compile and generate the extension into the ext directory in the PHP source program directory, where the source code of each extension module is stored. Select the module you need, such as curl module: cd /usr/webserver-soft/php-5.2.14/ext/curl/ Execute phpize to generate the compiled file. phpize is in the bin directory of the PHP installation directory.

  1. cd /home/src/curl-7.19.6
  2. ./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php/bin/ php-config
  3. make
  4. make install
Copy the code

In this way, curl.so will be copied to the corresponding PHP directory (such as: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/)

3. Modify the configuration in php.ini and 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

4. Check and restart Apache /usr/local/php/bin/php -v When executing this command, php checks whether the configuration file is correct.

5, check the loaded modules of php /usr/local/php/bin/php –m | grep curl



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn