TODO:macOS編譯PHP7.1

來源:互聯網
上載者:User

標籤:php7.1 openssl make install

TODO:macOS編譯PHP7.1

650) this.width=650;" class="alignnone size-full wp-image-1250" src="http://www.todosomeone.com/wp-content/uploads/2017/01/149d000289e6987a51f8-4.jpg" width="600" height="318" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="149d000289e6987a51f8-4.jpg" />

本文主要介紹在macOS上編譯PHP7.1,有興趣的朋友可以去嘗試一下。

1.下載PHP7.1源碼,建議到PHP官網下載純淨到源碼包php-7.1.0.tar.gz

2.解壓php-7.1.0.tar.gz包

3.建立配置

./configure –prefix=/usr/local/php7 –with-apxs=/usr/sbin/apxs –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-mysqli –with-pdo-mysql –with-iconv-dir –with-freetype-dir –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 –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –disable-fileinfo –enable-maintainer-zts

4.編譯代碼

make

650) this.width=650;" class="alignnone size-full wp-image-1251" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a200052bf163e42740-4.jpg" width="640" height="235" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a200052bf163e42740-4.jpg" />

make test

650) this.width=650;" class="alignnone size-full wp-image-1252" src="http://www.todosomeone.com/wp-content/uploads/2017/01/149d0002846cc8038906-4.jpg" width="865" height="261" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="149d0002846cc8038906-4.jpg" />

5.安裝php

make install

650) this.width=650;" class="alignnone size-full wp-image-1253" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a000052bc1869ccab7-4.jpg" width="640" height="343" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a000052bc1869ccab7-4.jpg" />

6.順利的花這樣就把php7.1編譯好了,把php7對應的執行檔案拷貝到/usr/bin/ 即可在終端使用了

sudo cp /usr/local/php7/bin/ph* /usr/bin/

650) this.width=650;" class="alignnone size-full wp-image-1254" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a3000280cd911e1db5-4.jpg" width="640" height="235" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a3000280cd911e1db5-4.jpg" />

650) this.width=650;" class="alignnone size-full wp-image-1255" src="http://www.todosomeone.com/wp-content/uploads/2017/01/149c0006cfbf23781a42-4.jpg" width="865" height="157" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="149c0006cfbf23781a42-4.jpg" />

7.編譯步驟是很簡單,但是編譯過程難免會遇到一些問題,以下是小編遇到的問題總結

8.安裝autoconf

650) this.width=650;" class="alignnone size-full wp-image-1256" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a000052c487b51e735-4.jpg" width="755" height="107" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a000052c487b51e735-4.jpg" />

9.openssl版本問題

configure: error: OpenSSL version 1.0.1 or greater required.

650) this.width=650;" class="alignnone size-full wp-image-1257" src="http://www.todosomeone.com/wp-content/uploads/2017/01/149d000285793e01103d-4.jpg" width="407" height="107" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="149d000285793e01103d-4.jpg" />

650) this.width=650;" class="alignnone size-full wp-image-1258" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a200052d2b15b2bdf4-4.jpg" width="865" height="108" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a200052d2b15b2bdf4-4.jpg" />

安裝更高版本的openssl或者下載openssl源碼來編譯,簡單的方法就是使用brew來安裝

650) this.width=650;" class="alignnone size-full wp-image-1259" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a3000281c6c0df5859-4.jpg" width="864" height="74" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a3000281c6c0df5859-4.jpg" />

10.Cannot find libz,這個需要安裝xcode-select,在終端輸入xcode-select –install

650) this.width=650;" class="alignnone size-full wp-image-1260" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a000052d204840164e-4.jpg" width="865" height="224" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a000052d204840164e-4.jpg" />

650) this.width=650;" class="alignnone size-full wp-image-1261" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a000052d2a08c45b00-4.jpg" width="640" height="238" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a000052d2a08c45b00-4.jpg" />

650) this.width=650;" class="alignnone size-full wp-image-1262" src="http://www.todosomeone.com/wp-content/uploads/2017/01/149c0006d12ab18f805e-4.jpg" width="865" height="260" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="149c0006d12ab18f805e-4.jpg" />

11.Cannot locate header file libintl.h

650) this.width=650;" class="alignnone size-full wp-image-1263" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a3000283448b9a83b3-4.jpg" width="865" height="270" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a3000283448b9a83b3-4.jpg" />

安裝gettext

650) this.width=650;" class="alignnone size-full wp-image-1264" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a10000639ddb9a353b-4.jpg" width="640" height="280" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a10000639ddb9a353b-4.jpg" />

編輯php源碼configure檔案

650) this.width=650;" class="alignnone size-full wp-image-1265" src="http://www.todosomeone.com/wp-content/uploads/2017/01/149d00028804a33f56f3-4.jpg" width="839" height="105" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="149d00028804a33f56f3-4.jpg" />

改成

650) this.width=650;" class="alignnone size-full wp-image-1266" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a3000283f8017b7ec1-4.jpg" width="865" height="94" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a3000283f8017b7ec1-4.jpg" />

12.mcrypt.h not found. Please reinstall libmcrypt.

650) this.width=650;" class="alignnone size-full wp-image-1267" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a10000642c43d2e46a-4.jpg" width="865" height="264" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a10000642c43d2e46a-4.jpg" />

安裝libmcrypt

650) this.width=650;" class="alignnone size-full wp-image-1268" src="http://www.todosomeone.com/wp-content/uploads/2017/01/14a30002844f49c0013d-4.jpg" width="640" height="245" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;" alt="14a30002844f49c0013d-4.jpg" />

13. 基本就是遇到這些情況了,還有一種使用php7的方法就是安裝MAMP,是商業軟體存在試用期限制,可以把安裝好的php7檔案取出來使用,小編試過,可以正常使用。

wxgzh:ludong86

650) this.width=650;" class="aligncenter size-full wp-image-845" src="http://www.todosomeone.com/wp-content/uploads/2016/11/qrcode_for_gh_6bb1f39ae99c_258-1.jpg" alt="qrcode_for_gh_6bb1f39ae99c_258-1" width="258" height="258" style="border:0px;vertical-align:middle;margin:0px auto;height:auto;text-align:center;" />


TODO:macOS編譯PHP7.1

聯繫我們

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