1、下载php源码php-7.0.11
# wget http://cn2.php.net/distributions/php-7.0.11.tar.bz2
2、安装php-devel
# yum install php-devel -y
3、编译安装php
# cd php-7.0.11/ # ./configure --prefix=/usr/local/php-7.0.11 --disable-debug --enable-shmop --with-gd --with-jpeg-dir=/usr/lib64 --with-png-dir=/usr/lib64 --with-libxml-dir=/usr/lib64 --with-zlib-dir=/usr/lib64 --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --enable-sockets --with-iconv--enable-mbstring --enable-mbregex --enable-ftp --enable-gd-native-ttf --enable-fpm --enable-pcntl --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --with-freetype-dir # make # make install
4、编译安装curl
4.1 下载c-ares
# wget https://c-ares.haxx.se/download/c-ares-1.10.0.tar.gz
4.2 编译安装
# tar xf c-ares-1.10.0.tar.gz # cd c-ares-1.10.0 # ./configure --prefix=/usr/local/ c-ares-1.10.0 # make # make install
4.3 下载编curl
# wget https://curl.haxx.se/download/curl-7.44.0.tar.bz2
4.4 编译安装curl启用异步支持c-ares
# tar xf curl-7.44.0.tar.bz2 # cd curl-7.44.0 # ./configure --prefix=/usr/local/curl-7.44.0 # make # make install # cat vim /etc/ld.so.conf.d/curl.conf /usr/local/curl-7.44.0/lib/ #ldconfig
5、制作php的curl扩展
# cd php-7.0.11/ext/curl # /usr/local/php-7.0.11/bin/phpize # ./configure --with-php-config=/usr/local/php-7.0.11/bin/php-config --with-curl=/usr/local/curl-7.44.0/ # make # make install # ls /usr/local/php-7.0.11/lib/php/extensions/no-debug-non-zts-20151012/ curl.so
6、查看AsynchDNS 是否启用
# /usr/local/php-7.0.11/bin/php -i /etc/php.ini | grep -A 20 curl curl cURL support => enabled cURL Information => 7.44.0 Age => 3 Features AsynchDNS => Yes CharConv => No Debug => No GSS-Negotiate => No IDN => Yes IPv6 => Yes krb4 => No Largefile => Yes libz => Yes NTLM => Yes NTLMWB => Yes SPNEGO => No SSL => Yes SSPI => No TLS-SRP => No
相关链接:
http://www.laruence.com/2014/01/21/2939.html 为什么要启用AsynchDNS原因
http://www.haiyun.me/archives/1070.html PHP重新动态编译Curl扩展添加异步DNS支持c-ares