##主题介绍 centos7.2下php5.5升级到php7的操作步骤

##下载php7镜像

$ wget -c http://cn2.php.net/get/php-7.0.11.tar.xz/from/this/mirror
$ tar xvf mirror
$ rm -rf /alidata/server/php
$ ln -sf /alidata/server/php-7.0.11 /alidata/server/php

##配置预编译脚本

  • 此操作是预编译,提示的error缺失什么,用yum安装

yum search ***,找到***-devel.x86_64,再yum install ***

$ ./configure \
--prefix=/alidata/server/php \
--with-config-file-path=/alidata/server/php/etc \
--with-apxs2=/alidata/server/httpd/bin/apxs \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-static \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--enable-tokenizer \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv=/usr/local/lib \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-xmlwriter \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--with-pear \
--enable-opcache

####如果是双核cpu,可以make -j2
$ lscpu

$ make && make install

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

$ vim /alidata/server/httpd/conf/httpd.conf
{
	<Ifmodule mime_module>
    		# 增加 php 文件类型支持
    		AddType application/x-httpd-php .php .html .htm
    		AddHandler application/x-httpd-php .php
	</IfModule>
}

$ service httpd restart