常常要用到linux環境下自己編譯安裝php,configure參數多,有時候不加註意使用的時候又要重新編譯php,所以將常用的configure指令整理如下。
第一步,安裝依賴套件:
yum -y install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel libaio
要安裝mcrypt擴展,可以使用指令:
yum install libmcrypt-devel
然後再使用指令:
yum install php-mcrypt
這樣就成功安裝mcrypt擴充功能了。
第二步,安裝php:
cd /tmp wget http://cn2.php.net/get/php-5.5.10.tar.gz/from/cn2.php.net/mirror tar -zxvf mirror cd ./php-5.5.10
然後執行指令:
./configure \ --prefix=/usr/local/php5 \ --with-config-file-path=/usr/local/php5/etc \ --with-bz2 \ --with-curl \ --enable-ftp \ --enable-sockets \ --disable-ipv6 \ --with-gd \ --with-jpeg-dir=/usr/local \ --with-png-dir=/usr/local \ --with-freetype-dir=/usr/local \ --enable-gd-native-ttf \ --with-iconv-dir=/usr/local \ --enable-mbstring \ --enable-calendar \ --with-gettext \ --with-libxml-dir=/usr/local \ --with-zlib \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-mysql=mysqlnd \ --enable-dom \ --enable-xml \ --with-libdir=lib64 \ --enable-pdo \ --enable-fpm \ --enable-mcrypt
編譯過程有可能報如下錯誤:
reee
checking for known struct flock definition… configure: error: Don’t know how to define struct flock on this system, set –enable-opcache=no
以上就介紹了linux原始碼編譯php5.4以上自備php-fpm的configure參數和依賴包,包括了方面的內容,希望對PHP教程有興趣的朋友有幫助。