PHP7.0正式版已經在2015年11月份左右發布,目前是PHP7.0.2版本,本人最早是從2015年8月php7的第一個測試版跟起,現在正式版發布。
linux版本:64位CentOS 6.6
Nginx版本:nginx1.8.0
php版本:php-7.0.2
下載
# wget http://php.net/get/php-7.0.2.tar.gz/from/a/mirror
建議安裝之前先看看安裝幫助文件INSTALL
解壓安裝
# tar zxvf php-7.0.2.tar.gz
# cd php-7.0.2
首先查看安裝幫助
# ./configure --help
# ./configure --prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip

如果配置錯誤,需要安裝需要的模塊,直接yum一並安裝依賴庫
# yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel
注意:安裝php7beta3的時候有幾處配置不過去,需要yum一下,現在php-7.0.2已經不用這樣了。
# yum -y install curl-devel
# yum -y install libxslt-devel
編譯安裝
# make && make install
配置文件
# cp php.ini-development /usr/local/php/lib/php.ini
# 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/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm
需要注意的是php7中www.conf這個配置文件配置phpfpm的端口號等信息,如果你修改默認的9000端口號需在這里改,再改nginx的配置
啟動
# /etc/init.d/php-fpm
# /etc/init.d/php-fpm
