当前位置:首页 > 操作系统 > Linux

linux源码编译php5.4以上自带php-fpm的configure参数和依赖包

经常要用到linux环境下自己编译安装php,configure参数繁多,有时候不加注意使用的时候又要重新编译php,所以将常用的configure命令整理如下。

第一步,安装依赖包:

yum -y install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel libaio

实际应该中可能还需要安装mcrypt扩展(典型错误:phpmyadmin报错,无法载入mcrypt扩展)。

要安装mcrypt扩展,可以使用命令:

yum install libmcrypt-devel

然后再使用命令:

yum install php-mcrypt

这样就成功安装mcrypt扩展了。

第二步,安装php:

cd /tmp
wget http://cn2.php.com/get/php-5.5.10.tar.gz/from/cn2.php.com/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

编译过程有可能报如下错误:

checking for known struct flock definition… configure: error: Don’t know how to define struct flock on this system, set –enable-opcache=no

解决方法是:

yum groupinstall "Development tools"

最后分别执行命令:

make
make install

以上就介绍了linux源码编译php5.4以上自带php-fpm的configure参数和依赖包,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!