1.本地上传 /usr/local/src/
php-7.2.0.tar.gz
2.解压
tar zxvf php-7.2.0.tar.gz
3.进入目录
cd php-7.2.0
4.配置
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --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-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-mysql --with-apxs2=/opt/apache/bin/apxs
5.发现缺少依赖 于是
yum install -y libxml2-devel
6.再次执行 4.配置
7.继续安装依赖
yum install openssl openssl-devel
yum -y install curl-devel
yum install libpng
yum install libpng-devel
yum install freetype-devel
8.继续执行4 配置
make -j4 && make install
9.测试
/usr/local/php/bin/php -v
10 开启mysql支持
cd /usr/local/php/etc/php-fpm.d
cp www.conf.default www.conf
11.修改www.conf 中的
12 .修改apache 配置文件 增加如下
AddType application/x-httpd-php .php