到http://pecl.php.net/package/找到這個:
http://pecl.php.net/package/pecl_http
編譯安裝,發現本地還沒有phpize,兩種方法安裝phpize:
第一種:
需要先下載對應的php版本包,然後包中就有phpize:
我的php版本是5.3.3
第二種:
也可以使用yum install php-devel安裝phpize
安裝成功之後重新到pecl目錄下phpize,之後./configure。報錯如下:
configure: error: Please install pecl/raphf and activate extension=raphf.so in your php.ini
這裏有解決方法:
http://stackoverflow.com/questions/25892808/ubuntu-pecl-install-pecl-http-fail
然後去pecl網站重新下載安裝了兩個包:
raphf
propro
然後./configure成功之後,make的時候報錯。
一大堆錯誤提示裏看到pcre.h沒有什麼的。
根據這裏的提示:http://wangye.org/blog/archives/313/
安裝yum install pcre-devel
之後make成功!
make test
make install
就可以了:
[root@LAMP1 pecl_http-2.5.0]# make install
Installing shared extensions: /usr/lib64/php/modules/
Installing header files: /usr/include/php/
[root@LAMP1 pecl_http-2.5.0]# pecl
最後我們到這裏看:
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
[root@LAMP1 modules]# ll
總用量 2816
-rwxr-xr-x. 1 root root 29584 10月 31 2014 bcmath.so
-rwxr-xr-x. 1 root root 66096 10月 31 2014 curl.so
-rwxr-xr-x. 1 root root 1843056 10月 31 2014 fileinfo.so
-rwxr-xr-x. 1 root root 36200 10月 31 2014 json.so
-rwxr-xr-x. 1 root root 136832 10月 31 2014 mysqli.so
-rwxr-xr-x. 1 root root 54408 10月 31 2014 mysql.so
-rwxr-xr-x. 1 root root 30112 10月 31 2014 pdo_mysql.so
-rwxr-xr-x. 1 root root 102456 10月 31 2014 pdo.so
-rwxr-xr-x. 1 root root 24640 10月 31 2014 pdo_sqlite.so
-rwxr-xr-x. 1 root root 261392 10月 31 2014 phar.so
-rwxr-xr-x. 1 root root 61787 7月 9 16:38 propro.so
-rwxr-xr-x. 1 root root 75713 7月 9 16:34 raphf.so
-rwxr-xr-x. 1 root root 44368 10月 31 2014 sqlite3.so
-rwxr-xr-x. 1 root root 83088 10月 31 2014 zip.so
[root@LAMP1 modules]# ll
總用量 4592
-rwxr-xr-x. 1 root root 29584 10月 31 2014 bcmath.so
-rwxr-xr-x. 1 root root 66096 10月 31 2014 curl.so
-rwxr-xr-x. 1 root root 1843056 10月 31 2014 fileinfo.so
-rwxr-xr-x. 1 root root 1818519 7月 9 16:47 http.so
-rwxr-xr-x. 1 root root 36200 10月 31 2014 json.so
-rwxr-xr-x. 1 root root 136832 10月 31 2014 mysqli.so
-rwxr-xr-x. 1 root root 54408 10月 31 2014 mysql.so
-rwxr-xr-x. 1 root root 30112 10月 31 2014 pdo_mysql.so
-rwxr-xr-x. 1 root root 102456 10月 31 2014 pdo.so
-rwxr-xr-x. 1 root root 24640 10月 31 2014 pdo_sqlite.so
-rwxr-xr-x. 1 root root 261392 10月 31 2014 phar.so
-rwxr-xr-x. 1 root root 61787 7月 9 16:38 propro.so
-rwxr-xr-x. 1 root root 75713 7月 9 16:34 raphf.so
-rwxr-xr-x. 1 root root 44368 10月 31 2014 sqlite3.so
-rwxr-xr-x. 1 root root 83088 10月 31 2014 zip.so
[root@LAMP1 modules]#
發現多了一個http.so,把這個加到php.ini裏就行了:
extension=http.so