1、下載源碼包程序php
# mkdir /tmp/php_buildmysql
# cd /tmp/php_buildc++
# wget http://cn2.php.net/distributions/php-7.2.9.tar.xz ##有其餘版本,這是比較老的版本了sql
2、安裝依賴vim
# yum install -y gcc-c++ libxml2-devel libxml2-devel libcurl-devel libcurl-devel openssl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-develcurl
3、建立用戶和組socket
# groupadd -r wwwphp-fpm
# useradd -s /usr/sbin/nologin -r -M -N wwwui
4、編譯安裝url
# tar Jxvf php-7.2.9.tar.xz -C /usr/local/
# cd /usr/local/php-7.2.9
# /configure \
--prefix=/usr/local/php-7.2.9 \
--with-config-file-path=/usr/local/php-7.2.9/etc \
--bindir=/usr/local/php-7.2.9/bin \
--sbindir=/usr/local/php-7.2.9/sbin \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir=/usr/local/freetype \
--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-gd \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-mhash \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--disable-fileinfo \
--enable-opcache
# make -j `grep processor /proc/cpuinfo | wc -l`
# make install #安裝完成後會生成/usr/local/php-7.2.9路徑
#後面根據須要修改PHP監聽方式就能夠了,一種是sock,一種是端口
#vim /usr/local/php-7.2.12/etc/php-fpm.d/www.conf
listen = /usr/local/php-7.2.9/var/run/php-7.2.9.sock
或listen = 0.0.0.0:9000;
#啓動命令路徑,執行後會有一個PHP主進程很若干個子進程
#/usr/local/php-7.2.9/sbin/php-fpm