Linux下共用方式編譯PHP擴充

來源:互聯網
上載者:User

標籤:io   使用   sp   檔案   on   bs   linux   as   安裝   

不管是安裝PHP 還是 後期給PHP 增加擴充,其實直接下載PHP的源碼包,把裡面的INSTALL檔案讀一遍就都會了。。

1,安裝PHP

安裝的話,不許要考慮那麼多,在各種依賴包安裝好之後,直接照著INSTALL中的方法先安裝一個簡單的PHP就好,然後再採用共用的方式把另外需要的PHP擴充包添加進去就OK!

2,extension安裝

PHP擴充的安裝,安裝官方的文檔是有兩種方式:pecl方式和phpize方式

然後擴充的加入方式也是兩種:共用和靜態(可能基本上都是採用共用的方式吧。。。。)

我採用的是:使用phpize以共用方式添加

在phpsrc目錄下,切換到:ext/extname   目錄下,執行如下命令:

命令很簡單:

$ cd extname
$ phpize  或者  phpize  --clean (這個是第一次安裝失敗,第二次安裝前做的一步清理動作)
$ ./configure
$ make
# make install

這個時候可能會提示一些錯誤,錯誤一般情況下是由於缺少一些庫導致的,以下是常見的一些錯誤:

錯誤: configure: error: Please reinstall the libcurl distribution - easy.h should be in <CURL-DIR>/include/curl/ 

解決: yum -y install curl-devel 

錯誤: If configure fails try --with-jpeg-dir=  configure: error: libpng.(a|so) not found.

解決: yum -y install libpng-devel  

錯誤: configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解決: yum install libmcrypt libmcrypt-devel

錯誤:configure: error: xml2-config not found. Please check your libxml2 installation.

解決: yum -y install libxml2 libxml2-devel

錯誤: configure: error: libevent >= 1.4.11 could not be found

解決: yum -y install libevent libevent-devel


Linux下共用方式編譯PHP擴充

聯繫我們

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