Centos7.4下安装PHP7.2.2

###安装php 安装PHP前,请先安装apache。
yum install -y libxml2 libxml2-devel openssl openssl-devel libcurl curl-devel perl perl-devel
#./configure #检查配置缺少什么包
yum install -y libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxslt-devel bzip2-devel

wget -O php-7.2.2.tar.gz http://cn.php.net/distributions/php-7.2.2.tar.gz
tar -zxvf php-7.2.2.tar.gz
cd php-7.2.2
./configure --prefix=/usr/local/php  --with-config-file-path=/etc/php/ --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd  --with-gd --with-iconv --with-bz2 --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --with-apxs2=/usr/local/apache/bin/apxs
make && make install
mkdir -p /etc/php
cp php.ini-development /etc/php/php.ini  #date.timezone =Asia/Shanghai

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

cp /usr/local/src/php-7.2.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

/etc/init.d/php-fpm start

chkconfig php-fpm on

posted @ 2018-02-27 09:49  haishashou  阅读(306)  评论(0编辑  收藏  举报