PHP7.0安裝筆記整理_php執行個體

來源:互聯網
上載者:User
2015年6月11日,PHP官網發布訊息,正式公開發布PHP7第一版的alpha版本.

PHP7特性:

PHP 7.0.0 Alpha 1使用新版的ZendEngine引擎,帶來了許多新的特性,以下是不完全列表:

(1)效能提升:PHP7比PHP5.6效能提升了兩倍。 Improved performance: PHP 7 is up to twice as fast as PHP 5.6

(2)全面一致的64位支援。 Consistent 64-bit support

(3)以前的許多致命錯誤,現在改成拋出異常。Many fatal errors are now Exceptions

(4)移除了一些老的不在支援的SAPI(伺服器端應用編程連接埠)和擴充。Removal of old and unsupported SAPIs and extensions

(5)新增了空接合操作符。The null coalescing operator (??)

(6)新增加了結合比較子。Combined comparison Operator (<=>)

(7)新增加了函數的傳回型別聲明。Return Type Declarations

(8)新增加了標量型別宣告。Scalar Type Declarations

(9)新增加匿名類。Anonymous Classes

php7安裝筆記整理

# 安裝mcrypt

yum install -y php-mcrypt libmcrypt libmcrypt-devel

# 升級bison

cd /var/soft/wget http://ftp.gnu.org/gnu/bison/bison-2.6.4.tar.gztar -xvzf bison-2.6.4.tar.gz cd bison-2.6.4./configuremake && make install

# 升級re2c,解決You will need re2c 0.13.4 or later if you want to regenerate PHP

parsers.錯誤

cd /var/soft/wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/downloadtar zxf re2c-0.13.5.tar.gz && cd re2c-0.13.5./configuremake && make install

編譯PHP7

# 建立目錄mkdir -p /var/soft/php7cd /var/soft/php7# 下載原始碼git clone http://git.php.net/repository/php-src.gitcd php-src./buildconf# 配置參數./configure --prefix=/usr/local/php7 \--with-config-file-path=/usr/local/php7/etc \--with-mcrypt=/usr/include \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-gd \--with-iconv \--with-zlib \--enable-xml \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--enable-mbregex \--enable-fpm \--enable-mbstring \--enable-ftp \--enable-gd-native-ttf \--with-openssl \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--without-pear \--with-gettext \--enable-session \--with-curl \--with-jpeg-dir \--with-freetype-dir \--enable-opcache################################################################################## 編譯安裝php時出現 /encodings.c:101: undefined reference to `libiconv_close' 錯誤的解決方案# 在裝php時出現以下的錯誤:# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv_open'# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:81: undefined reference to `libiconv'# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'# collect2: error: ld returned 1 exit status# make: *** [sapi/cli/php] Error 1# 根據php官網描述這是一個bug(https://bugs.php.net/bug.php?id=52611)。在configure以後要手動修改下Makefile檔案,找到EXTRA_LIBS 在最後添加 -liconv 即可順利通過# (大約在Makefile檔案的104)# EXTRA_LIBS = -lcrypt -lz -lresolv -lcrypt -lrt -lmysqlclient -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcurl -lxml2 -lz -lm -ldl -lfreetype -lmysqlclient -lz -lm -lssl -lcrypto -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcrypt -liconv################################################################################## 編譯安裝make && sudo make install

# 配置

cp php.ini-production /usr/local/php7/etc/php.inicp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpmchmod +x /etc/init.d/php7-fpmcp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.confcp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

# 配置opcache

vim /usr/local/php7/etc/php.ini# 加入zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/opcache.so# 啟動/etc/init.d/php7-fpm start

# 查看PHP版本

/usr/local/php7/bin/php -v

結果:

PHP 7.0.0-dev (cli) (built: Mar 3 2015 10:02:26) Copyright (c) 1997-2015 The PHP GroupZend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies  with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

以上就是本文給大家分享的PHP7.0 安裝筆記整理,希望對大家有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.