centos php7 编译安装

黎东
L、先森
2018-07-20 0 1418

下载php7版本:

wget http://cn2.php.NET/distributions/php-7.0.6.tar.gz

编译安装:

./configure  --prefix=/alidata/server/php7 --with-config-file-path=/alidata/server/php7/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www  --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl  --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts  --enable-opcache --with-iconv=/usr/local/libiconv

make

make install

拷贝配置文件:

cp ./php.ini-production /alidata/server/php7/etc/php.ini

配置php7的php-fpm与php5的php-fpm共存:

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm

#复制一份新的php-fpm.conf
cp /alidata/server/php7/etc/php-fpm.conf.default /alidata/server/php7/etc/php-fpm.conf

#复制一份新的www.conf
cp /alidata/server/php7/etc/php-fpm.d/ /alidata/server/php7/etc/php-fpm.d/www.conf


php