Heim  >  Artikel  >  Backend-Entwicklung  >  PHP添加CURL扩展库的二种方法

PHP添加CURL扩展库的二种方法

WBOY
WBOYOriginal
2016-07-25 08:56:191296Durchsuche
  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
复制代码

2,编译生成扩展进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块: cd /usr/webserver-soft/php-5.2.14/ext/curl/ 执行phpize生成编译文件,phpize在PHP安装目录的bin目录下

  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
复制代码

这样,curl.so就被复制到PHP对应目录(如: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/)

3,修改配置在php.ini里,设置扩展目录: extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/" 并添加扩展模块引用: extension = curl.so

4,检查并重启Apache /usr/local/php/bin/php -v 执行此命令时,php检查配置文件是否正确。

5,检查php已加载的模块 /usr/local/php/bin/php –m | grep curl



Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn