PHP7發布了,但是如何編譯呢?

來源:互聯網
上載者:User
windows上如何編譯最新發行的php?

回複內容:

windows上如何編譯最新發行的php?

Windows上編譯安裝PHP教程請看:
https://wiki.php.net/internals/windows/stepbystepbuild
以5.4為例:
PHP 5.4(原始碼+依賴庫+SDK工具) + Visual Studio 2008 + Windows SDK 6.1
http://windows.php.net/downloads/releases/php-5.4.45-src.zip
http://windows.php.net/downloads/php-sdk/deps-5.4-vc9-x86.7z
http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip
https://www.microsoft.com/en-us/download/details.aspx?id=11310 (啟動Windows SDK 6.1安裝程式後,需要下載1.2G的資料和3GB的磁碟空間)
http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso 英文版
http://download.microsoft.com/download/3/0/2/3025EAE6-2E15-4972-972A-F5B1ED248E85/VS2008ExpressWithSP1CHSX1504735.iso 中文版
注意順序!先安裝Windows SDK 6.1及其service packs和security updates,
然後安裝Visual Studio 2008 Express Edition SP1(運行Setup.hta,選擇安裝Visual C++ 2008).

開始菜單開啟 Windows SDK v6.1 CMD shell 執行 setenv /x86 /xp /release
建立目錄C:\php-sdk,並把php-sdk-binary-tools解壓到這個目錄.
cd C:\php-sdk\
bin\phpsdk_buildtree.bat phpdev
把PHP原始碼解壓到C:\php-sdk\phpdev\vc9\x86,比如:
C:\php-sdk\phpdev\vc9\x86\php-5.4.45-src
把deps-5.4-vc9-x86.7z解壓到
C:\php-sdk\phpdev\vc9\x86\deps
開始編譯:
cd C:\php-sdk\
bin\phpsdk_setvars.bat (設定環境變數,否則configure時會提示找不到bison之類的工具)
cd C:\php-sdk\phpdev\vc9\x86\php-5.4.45-src
buildconf
如果出現 輸入錯誤: 沒有檔案擴充“.js”的指令碼引擎。
regedit 把 [HKEY_CLASSES_ROOT\.js] 項下的那個預設值改成JSFile
重新執行 buildconf 就可以產生 configure.js 了.
configure --help
configure --disable-zts --disable-all --enable-cli
執行 nmake 編譯, 編譯後產生的二進位檔案位於:
C:\php-sdk\phpdev\vc9\x86\php-5.4.45-src\Release
運行 nmake snap 打包:
C:\php-sdk\phpdev\vc9\x86\php-5.4.45-src\Release\php-5.4.45-nts-Win32-VC9-x86.zip
重新編譯:
nmake clean 清除舊的二進位檔案
rd /s /q Release
buildconf --force 產生新的configure.js指令碼
configure --disable-zts --disable-all --enable-cli
nmake

解壓即用,跨Linux發行版PHP7打包(附編譯打包方法)

https://wiki.php.net/phpng

#安裝編譯PHP依賴的開發工具和庫:sudo apt-get install \build-essential \autoconf \libtool \re2c \libxml2-dev \openssl \libcurl4-openssl-dev \libbz2-dev \libjpeg-dev \libpng12-dev \libfreetype6-dev \libldap2-dev \libmcrypt-dev \libmysqlclient-dev \libxslt1-dev \libxt-dev \libpcre3-dev \libxpm-dev \libt1-dev \libgmp-dev \libpspell-dev \librecode-dev \libreadline6-dev #配置指令碼 configure_php.sh#!/bin/bash./configure \--prefix=/png/php/7.0.0 \--enable-opcache \--enable-fpm \--enable-pdo \--enable-sockets \--enable-exif \--enable-soap \--enable-ftp \--enable-wddx \--enable-pcntl \--enable-soap \--enable-bcmath \--enable-mbstring \--enable-dba \--enable-gd-native-ttf \--enable-gd-jis-conv \--enable-zip \--enable-calendar \--enable-shmop \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--with-mysqli \--with-pdo-mysql \--with-pdo-sqlite \--with-iconv \--with-gmp \--with-pspell \--with-xmlrpc \--with-openssl \--with-mhash \--with-mcrypt \--with-xsl \--with-curl \--with-pcre-regex \--with-gd \--with-jpeg-dir=/usr \--with-png-dir=/usr \--with-zlib-dir=/usr \--with-xpm-dir=/usr \--with-freetype-dir=/usr \--with-gettext=/usr \--with-zlib=/usr \--with-bz2=/usr \--with-recode=/usr \--with-ldap \--with-pear \--with-readline \--with-fpm-user=png \--with-fpm-group=png \--with-apxs2=/png/httpd/2.4.17/bin/apxs#編譯安裝make && make install

官網目前還沒有提供編譯好的版本,而目前官方可下載的源碼也不是支援Windows的,不過PHP源碼庫中有Windows編譯的內容。
送個地址,官方編譯的DLL地址,目前最新的是 7.0 RC8 的版本
http://windows.php.net/qa/

如果是Linux編譯環境或者Mac OS X環境,可以參考我的文章http://segmentfault.com/a/1190000004065931

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.