Home > Backend Development > PHP Tutorial > 配置php的curl扩充

配置php的curl扩充

WBOY
Release: 2016-06-13 11:58:14
Original
915 people have browsed it

配置php的curl扩展

linux下:

=====================================================

1.安装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.编译生成扩展
进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:
cd curl
执行phpize生成编译文件,phpize在PHP安装目录的bin目录下
/usr/local/php5/bin/phpize
运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.“,需要安装autoconf:
yum install autoconf(RedHat或者CentOS)、apt-get install autoconf(Ubuntu Linux)


生成配置文件,并编译生成模块:
/usr/local/php5/bin/phpize
./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php5/bin/php-config
make
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会去检查配置文件是否正确,如果有配置错误,这里会报错,可以根据错误信息去排查

?

windows下:

=======================================================

1.将PHP安装文件夹下的三个文件php_curl.dll(可能在ext文件夹中),libeay32.dll,ssleay32.dll 复制到 %windir%/system32下;
  2.打开php.ini(可能在PHP环境的安装目录下,默认在c:\WINDOWS目录下),将;extension=php_curl.dll头部的分号去掉;
  3.重启php的服务(apache或者IIS),如重启IIS,运行iisreset即可。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template