原文地址:http://blog.csdn.net/21aspnet/article/details/47708763
PHP7和HHVM比較
PHP7的在真實場景的性能確實已經和HHVM相當, 在一些場景甚至超過了HHVM。HHVM的運維復雜, 是多線程模型, 這就代表着如果一個線程導致crash了, 那么整個服務就掛了, 並且它不會自動重啟。另外它采用JIT, 那么意味着, 重啟以后要預熱, 沒有預熱的情況下, 性能較為糟糕。並且多線程模型調試困難, 這對於追求穩定來說的Web服務來說, 是非常不適合的.
Nginx以及PHP7.0之前的版本可以參考此文:Linux環境Nginx安裝與調試以及PHP安裝
PHP7.0正式版預計在2015年10月份左右發布,目前是PHP7.0 beta3版本
linux版本:64位CentOS 7.0
Nginx版本:nginx1.8.0
php版本:php7.0.0
下載
# wget https://downloads.php.net/~ab/php-7.0.0beta3.tar.gz
建議安裝之前先看看安裝幫助文件INSTALL
解壓安裝
# tar zxvf php-7.0.0beta3.tar.gz
# cd php-7.0.0beta3
首先查看安裝幫助
# ./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
注意:安裝php7的時候有幾處配置不過去,需要yum一下。
# 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
啟動
# /etc/init.d/php-fpm
# /etc/init.d/php-fpm
查看phpinfo()
