標籤:native 1.7 ror configure 操作 waiting tracking sem his
php7的安裝
wget http://am1.php.net/get/php-7.0.4.tar.gz/from/this/mirrortar zvxf php-7.0.4.tar.gzcd php-7.0.4./configure --prefix=/data/php7 --with-config-file-path=/data/php7/etc --with-icu-dir=/usr --with-xsl --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --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 --enable-intl --enable-pcntl --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fileinfo --enable-opcache --with-xsl
1、出現錯誤:
Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
解決方案:
yum install -y icu libicu libicu-devel configure參數添加 --with-icu-dir=/usr
2、出現故障:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解決方案:
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gztar -zxvf libmcrypt-2.5.8.tar.gzcd /usr/local/src/libmcrypt-2.5.8./configure makemake install
3問題:
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解決:
yum install -y libxslt libxslt-devel libxml2 libxml2-devel configure加上--with-xsl
出問題解決網站:https://teddysun.com/363.html(非廣告哈,確實幫我大忙了)
假設make時候出現liconv相關錯誤。可進行一下操作
vim Makefile 找到 EXTRA_LIBS 添加 -liconv
最後進行編譯安裝
make && make install
php.ini檔案和php-fpm.conf檔案產生。
cp php.ini-production /usr/local/php7/etc/php.inicd /usr/src/php-7.0.4/sapi/fpmcp init.d.php-fpm /etc/init.d/php-fpmchmod +x /etc/init.d/php-fpmchkconfig --add php-fpmchkconfig php-fpm on
為了php7效能再次提升,能夠參考鳥哥部落格http://www.laruence.com/2015/12/04/3086.html
discuz的php7版本號碼,由於博主第一次做開源。所以裡面的redme文檔沒有寫。
代碼地址:https://code.csdn.net/zzh787272581/dz-yboard-cn/tree/master(代碼僅僅能在php7同意,原因在後面有說明)
裡面主要改動點:
1、將eval去掉。這裡不針對php7去改動,僅僅是博主認為這個函數線上上server不安全。
2、將preg_replace帶有/e 修飾符所有替換成preg_replace_callback 函數,將preg_replace裡面數組形式替換成preg_replace_callback_array;這裡由於用了preg_replace_callback_array,僅僅能在php7下執行。
3、有一些地方寫死了mysql的函數,這裡將所有替換成mysqli的函數進行書寫。
最後貼一張php5.4和php7以下dz首頁的ab壓測圖。機器不好。所以qps不是非常好看。
都是用 ab -n 500 -c http://dz.yboard.cn/
php7
C:\Users\Administrator>ab -n 100 -c 100 http://dz.yboard.cn/This is ApacheBench, Version 2.3 <$Revision: 1604373 $>Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking dz.yboard.cn (be patient).....doneServer Software: nginxServer Hostname: dz.yboard.cnServer Port: 80Document Path: /Document Length: 0 bytesConcurrency Level: 100Time taken for tests: 0.182 secondsComplete requests: 100Failed requests: 0Non-2xx responses: 100Total transferred: 19100 bytesHTML transferred: 0 bytesRequests per second: 550.36 [#/sec] (mean)Time per request: 181.700 [ms] (mean)Time per request: 1.817 [ms] (mean, across all concurrent requests)Transfer rate: 102.65 [Kbytes/sec] receivedConnection Times (ms) min mean[+/-sd] median maxConnect: 0 1 1.0 1 5Processing: 11 100 52.8 107 168Waiting: 3 96 54.5 102 167Total: 12 102 52.4 109 168Percentage of the requests served within a certain time (ms) 50% 109 66% 147 75% 153 80% 155 90% 162 95% 165 98% 167 99% 168 100% 168 (longest request)
php5.4.45
C:\Users\Administrator>ab -n 100 -c 100 http://dz-php5.yboard.cn/This is ApacheBench, Version 2.3 <$Revision: 1604373 $>Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking dz-php5.yboard.cn (be patient).....doneServer Software: nginxServer Hostname: dz-php5.yboard.cnServer Port: 80Document Path: /Document Length: 0 bytesConcurrency Level: 100Time taken for tests: 0.222 secondsComplete requests: 100Failed requests: 0Non-2xx responses: 100Total transferred: 17700 bytesHTML transferred: 0 bytesRequests per second: 450.15 [#/sec] (mean)Time per request: 222.150 [ms] (mean)Time per request: 2.221 [ms] (mean, across all concurrent requests)Transfer rate: 77.81 [Kbytes/sec] receivedConnection Times (ms) min mean[+/-sd] median maxConnect: 0 1 1.4 1 5Processing: 76 122 16.8 127 145Waiting: 76 121 16.6 127 144Total: 77 123 16.2 129 145Percentage of the requests served within a certain time (ms) 50% 129 66% 132 75% 134 80% 135 90% 140 95% 143 98% 145 99% 145 100% 145 (longest request)
總的來說,效能還是有非常大提升的。
歡迎各位同學直接拿來測試使用。假設有問題歡迎提出,我會一直維護這個php7版本號碼,可私下聯絡我QQ:787272581
discuz的php7版本號碼