當前位置:學問君>人在職場>電腦培訓>

PHP使用方法之phpize

學問君 人氣:5.51K

安裝(fastcgi模式)的時候,常常有這樣一句命令:

PHP使用方法之phpize

複製代碼 代碼如下:

/usr/local/webserver/PHP/bin/phpize

一、phpize是幹嘛的?

phpize是什麼?

phpize是用來擴展php擴展模組的,透過phpize可以建立php的外掛模組

比如你想在原來編譯好的php中加入memcached或者ImageMagick等擴展模組,可以使用phpize,透過以下幾步工作。

二、如何使用phpize?

當php編譯完成後,php的bin目錄下會有phpize這個腳本檔案。在編譯你要添加的擴展模組之前,執行以下phpize就可以了;

比如現在想在php中加入memcache擴展模組:我們要做的只是如下幾步

複製代碼 代碼如下:

tar zxvf

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檔案的路徑

這樣編譯就完成了,還需要做的是在檔案中加入extension值

複製代碼 代碼如下:

extension = “”

注意:Cannot find config.m4.

這個錯誤是一個很傻的錯誤,解壓以後需要cd到檔案夾,不然phpize就會報錯

動態編譯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

# tar -zvxf

# cd m4-1.4.9/

# ./configure && make && make install

# cd ../

# wget

# tar -zvxf

# 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 install

TAGS:phpize PHP