phpize的深刻理解

安裝(fastcgi模式)的時候,經常有這樣一句命令:/usr/local/webserver/php/bin/phpize
1、phpize是幹嗎的?
phpize是什麼東西呢?php官方的說明:
http://php.net/manual/en/install.pecl.phpize.php
phpize是用來擴展php擴展模塊的,經過phpize能夠創建php的外掛模塊
好比你想在原來編譯好的php中加入memcached或者ImageMagick等擴展模塊,可使用phpize,經過如下幾步工做。
2、如何使用phpize?
當php編譯完成後,php的bin目錄下會有phpize這個腳本文件。在編譯你要添加的擴展模塊以前,執行如下phpize就能夠了;
好比如今想在php中加入memcache擴展模塊:咱們要作的只是以下幾步
————————————————————————
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure –with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
————————————————————————
注意./configure 後面能夠指定的是php-config文件的路徑
這樣編譯就完成了,還須要作的是在php.ini文件中加入extension值
extension = 「memcache.so」
---------------------------------------------------------
注意:Cannot find config.m4.
這個錯誤是一個很傻的錯誤,解壓之後須要cd到文件夾,否則phpize就會報錯php

動態編譯PHP的memcache擴展庫,在執行/usr/localphp/bin/phpize時出現了錯誤,
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.
很明顯缺乏文件,須要安裝。網上找了下資料。
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
# tar -zvxf autoconf-2.62.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install
而後執行如下命令進行安裝
#/usr/local/php/bin/phpize
#./configure –prefix=/usr/local/memcached –with-libevent=/usr/local/libevent –with-php-config=/usr/local/php/bin/php-config
#make && make installweb

相關文章
相關標籤/搜索