亚洲精品日韩欧美_欧美二区乱c少妇_中文字幕日韩在线播放_日韩不卡中文字幕

English |
  • 美國VPS主機(jī)推薦
  • |
  • 代購服務(wù)
  • |
  • 10美元以下VPS
  • |
  • VPS新手指南/教程
  • |
  • 留言板
  • |
  • 關(guān)于
  • | 登錄 |

    lnmp之安裝PHP模塊/擴(kuò)展(不需要重裝PHP)

    2010年08月16日 下午 | 作者:VPS偵探

    VPS偵探一直在努力的去營造一個VPS相關(guān)話題的交流環(huán)境,于是有了很多的VPS相關(guān)的教程、QQ群、有了論壇、有了LNMP一鍵安裝包...,在此說明一下Linux下PHP模塊/擴(kuò)展都是采用此方法安裝或安裝php直接編譯進(jìn)去,PHP的dll模塊/擴(kuò)展文件是Windows下php模塊的使用方法,兩者是無法通用的!!

    VPS偵探主要根據(jù)論壇上lnmp版塊用戶反映來寫一些教程,今天說一下如何為lnmp的php安裝一些自己需要的模塊,下面主要有兩種方式進(jìn)行安裝:源碼編譯方式安裝和pecl方式進(jìn)行安裝

    源碼編譯安裝

    安裝前

    安裝前建議先執(zhí)行 /usr/local/php/bin/php -m (此命令顯示目前已經(jīng)安裝好的PHP模塊)看一下,要安裝的模塊是否已安裝。然后下載當(dāng)前PHP版本的源碼并解壓。

    大部分php擴(kuò)展/模塊的源碼編譯安裝就是三個步驟,在源碼目錄下執(zhí)行:
    /usr/local/php/bin/phpize
    ./configure --with-php-config=/usr/local/php/bin/php-config
    make && make install
    有些模塊可能會稍微有差異(如要求添加一些參數(shù)),但是 --with-php-config=/usr/local/php/bin/php-config 是所有PHP模塊最基本的參數(shù)這個是必須要有的,具體看模塊的安裝文檔就可以。

    本文以imap和exif模塊為例,進(jìn)入php源碼目錄下ext,里面會有大部分模塊的源碼,這里都是php自帶模塊,第三方模塊的話需要自己找第三方模塊的源碼。

    一、安裝imap模塊

    1、安裝imap模塊前需要先安裝imap所需的庫:

    CentOS :yum install libc-client-devel

    Debian:apt-get install libc-client-dev

    2、首先進(jìn)入php安裝目錄的ext目錄

    比如php的源碼目錄為:/root/lnmp1.3-full/src/php-5.4.45/

    則執(zhí)行:cd /root/lnmp1.3-full/src/php-5.4.45/ext/? ###一般安裝完LNMP php源碼都是自動刪除了的,需要自己進(jìn)入src目錄下解壓對應(yīng)版本的php源碼包。###

    我們要安裝imap模塊,執(zhí)行cd imap/

    再執(zhí)行 /usr/local/php/bin/phpize 會返回如下信息:
    Configuring for:
    PHP Api Version:???????? 20041225
    Zend Module Api No:????? 20060613
    Zend Extension Api No:?? 220060519

    再執(zhí)行以下命令:

    [root@vpser imap]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap-ssl

    [root@vpser imap]# make && make install

    執(zhí)行完返回:

    Build complete.
    Don't forget to run 'make test'.

    Installing shared extensions:???? /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

    表示已經(jīng)成功,再修改/usr/local/php/etc/php.ini

    查找:extension_dir 再下面一行添加上extension = "imap.so"

    保存,執(zhí)行/etc/init.d/php-fpm restart 重啟。

    在瀏覽器里面輸入http://ip/p.php,打開探針,安裝IMAP模塊前:

    安裝IMAP模塊后:

    二、安裝exif模塊

    安裝exif不需要另外安裝庫,所以省略掉了安裝庫的步驟。

    比如php的源碼目錄為:/root/lnmp1.3-full/src/php-5.4.45/

    則執(zhí)行:cd /root/lnmp1.3-full/src/php-5.4.45/ext/

    我們要安裝exif模塊,執(zhí)行cd exif/

    再執(zhí)行 /usr/local/php/bin/phpize 會返回如下信息:
    Configuring for:
    PHP Api Version:???????? 20041225
    Zend Module Api No:????? 20060613
    Zend Extension Api No:?? 220060519

    再執(zhí)行以下命令:

    [root@vpser imap]# ./configure --with-php-config=/usr/local/php/bin/php-config

    [root@vpser imap]# make && make install

    執(zhí)行完返回:

    Build complete.
    Don't forget to run 'make test'.

    Installing shared extensions:???? /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

    表示已經(jīng)成功,再修改/usr/local/php/etc/php.ini

    查找:extension = 再最后一個extension= 后面添加上extension = "exif.so"

    保存,執(zhí)行/etc/init.d/php-fpm restart 重啟。

    在/home/wwwroot/下面創(chuàng)建一個exif.php的文件,內(nèi)容如下:

    <?php

    $exif = read_exif_data ('IMG_0001.JPG');
    while(list($k,$v)=each($exif)) {
    echo "$k: $v<br>\n";
    }

    ?>

    其中IMG_0001.JPG為照片文件。

    未安裝exif模塊前:

    安裝exif模塊后:

    可以讀出照片的exif信息。

    安裝其他模塊也基本上都是這兩種方式,當(dāng)./configure --with-php-config=/usr/local/php/bin/php-config 執(zhí)行這個的時候是會檢查系統(tǒng)上庫是否安裝上,如果沒有安裝上就會報錯,按錯誤提示安裝相關(guān)的庫就行。

    pecl方式安裝

    pecl方式安裝是使用pecl install xxx 命令的方式,xxx為php模塊名字,但是該php模塊必須是 https://pecl.php.net 上面的且必須要提前按要求安裝好依賴包,不同php模塊可能不需要也可以需要安裝,具體可以官網(wǎng)手冊 https://www.php.net/manual/en/index.php 中查詢。

    lnmp默認(rèn)禁用掉了部分php函數(shù),需要將exec、popen、readlink這些函數(shù)從禁用函數(shù)中去掉,可以在/usr/local/php/etc/php.ini 中查找disable_function 就可以在后面看到是否有禁用函數(shù)。

    安裝好依賴包就可以直接,pecl install xxx 進(jìn)行安裝php模塊。

    如果還有其他問題,可以到https://bbs.vpser.net提問,記得提問前在https://bbs.vpser.net/search.php搜索一下哦。

    >>轉(zhuǎn)載請注明出處:VPS偵探 本文鏈接地址:http://m.0794baidu.com/manage/lnmp-php-install-ext.html
    VPS偵探推薦:
    遨游主機(jī)VultrLinode搬瓦工LOCVPSKVMLAHOSTKVMHostXen80VPS美國VPS主機(jī),國內(nèi)推薦騰訊云阿里云

    發(fā)表評論

    *必填

    *必填 (不會被公開)

    評論(42條評論)

    1. VPSer說道:

      @Andy, 提前前可以到論壇里搜索一下,http://bbs.vpser.net/thread-6120-1-1.html

    2. Andy說道:

      在Centos5下可以成功編譯。
      但是在Centos6-64bit編譯imap時出現(xiàn):
      checking for IMAP support... yes, shared
      checking for IMAP Kerberos support... yes
      checking for IMAP SSL support... yes
      checking for utf8_mime2text signature... new
      checking for U8T_DECOMPOSE...
      checking for pam_start in -lpam... yes
      checking for crypt in -lcrypt... yes
      configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

      怎么解決啊。
      謝謝啦。

    3. VPSer說道:

      @祝正江, 前面的一步報錯了吧

    4. 祝正江說道:

      執(zhí)行"make && make install” 報錯 “make: *** No targets specified and no makefile found. Stop.”

    5. tt說道:

      我從來就沒有改過路徑,路徑?jīng)]有錯,但就是一直提示找不到php-config, 搞不懂了,可以幫我想想辦法不?

    6. VPSer說道:

      @tt, --with-php-config=PATH PATH換成你的php-config的路徑。configure: error: This c-client library is built with Kerberos support. 參見:http://bbs.vpser.net/viewthread.php?tid=1557&page=1&fromuid=3#pid4466

    7. tt說道:

      一直提示找不到php-config,難道要重新編譯安裝php?怎么編譯安裝?最好可以告訴代碼,新手,謝謝

    8. tt說道:

      執(zhí)行這個./configure --with-php-config=/usr/local/php/bin/php-config命令的時候,提示如下錯誤

      configure: error: This c-client library is built with Kerberos support.

      Add --with-kerberos to your configure line. Check config.log for details.

      我就在php-config里的增加了‘--with-kerberos'

      再次執(zhí)行./configure --with-php-config=/usr/local/php/bin/php-config
      提示錯誤configure: error: Cannot find php-config. Please use --with-php-config=PATH 找不到php-config這個文件,即使我把php-config改回去,依然提示找不到php-config文件,

      怎么回事?

    9. VPSer說道:

      @無名指, 安裝imap需要一些其他的依賴包,詳細(xì)查看http://bbs.vpser.net/viewthread.php?tid=1150

    10. 無名指說道:

      checking for gawk... gawk
      checking for IMAP support... yes, shared
      checking for IMAP Kerberos support... no
      checking for IMAP SSL support... no
      checking for utf8_mime2text signature... new
      checking for U8T_DECOMPOSE...
      checking for pam_start in -lpam... yes
      checking for crypt in -lcrypt... yes
      configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

      沒有安裝庫?

    11. VPSer說道:

      @teddy,
      configure: error: This c-client library is built with Kerberos support.
      Add --with-kerberos to your configure line. Check config.log for details.這里已經(jīng)提示錯誤原因了。
      執(zhí)行configure哪一步時在編譯參數(shù)上加上--with-kerberos 再重新編譯,不報錯了再make

    12. teddy說道:

      按此方法安裝imap模塊沒成功.

      裝到[root@vpser imap]# ./configure --with-php-config=/usr/local/php/bin/php-config這一步提示如下:

      [root@tedy imap]# ./configure --with-php-config=/usr/local/php/bin/php-config
      checking for egrep... grep -E
      checking for a sed that does not truncate output... /bin/sed
      checking for cc... cc
      checking for C compiler default output file name... a.out
      checking whether the C compiler works... yes
      checking whether we are cross compiling... no
      checking for suffix of executables...
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether cc accepts -g... yes
      checking for cc option to accept ANSI C... none needed
      checking how to run the C preprocessor... cc -E
      checking for icc... no
      checking for suncc... no
      checking whether cc understands -c and -o together... yes
      checking for system library directory... lib
      checking if compiler supports -R... no
      checking if compiler supports -Wl,-rpath,... yes
      checking build system type... i686-pc-linux-gnu
      checking host system type... i686-pc-linux-gnu
      checking target system type... i686-pc-linux-gnu
      checking for PHP prefix... /usr/local/php
      checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
      checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613
      checking for PHP installed headers prefix... /usr/local/php/include/php
      checking if debug is enabled... no
      checking if zts is enabled... no
      checking for re2c... no
      configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
      checking for gawk... gawk
      checking for IMAP support... yes, shared
      checking for IMAP Kerberos support... no
      checking for IMAP SSL support... no
      checking for utf8_mime2text signature... old
      checking for U8T_CANONICAL... no
      checking for pam_start in -lpam... no
      checking for crypt in -lcrypt... yes
      configure: error: This c-client library is built with Kerberos support.

      Add --with-kerberos to your configure line. Check config.log for details.

      好象沒有kerberos.

      裝到[root@vpser imap]# make && make install提示如下:

      make: *** No targets specified and no makefile found. Stop.

      請回咋辦

      用的是lnmp0.4

    13. VPSer說道:

      @shiny, 我這邊正常,通過webkaka測試的地市也都是正常的。

    14. shiny說道:

      vpser GFWed?

    15. VPSer說道:

      @vowanson, 無法平滑升級,肯定會中斷一小會兒。按照lnmp腳本下載新版的php,重新編譯安裝,然后重啟就可以。

    16. vowanson說道:

      ?? ??

      有沒有平滑升級PHP的方法哦,就是不需要重裝PHP的升級到5.2.14. :mrgreen: :mrgreen:

    主站蜘蛛池模板: 99视频精品全部免费看| 亚洲免费视频一区| 日本一区二区三区www| 久久精品亚洲精品| 国产精品精品久久久久久| 欧美一区二区视频97| 国产精品久久av| 欧美老熟妇喷水| 午夜精品在线视频| 国产成人高潮免费观看精品| 激情综合在线观看| 久久精品国产理论片免费| 欧美亚洲另类久久综合| 亚洲国产精品www| 电影午夜精品一区二区三区| 国产精品亚洲天堂| 欧美激情一级精品国产| 日韩免费观看网站| 午夜精品久久久久久久99热| 91精品国产网站| 国产不卡一区二区在线播放| 亚洲福利av| 国产日韩在线观看av| 韩国日本不卡在线| 免费av在线一区| 国产精品久久久久久久久免费看 | 欧美一区二视频在线免费观看| 亚洲伊人婷婷| 亚洲a区在线视频| 亚洲一区二区三区在线免费观看| 99高清视频有精品视频| 91精品国产自产91精品| 中文字幕日韩精品无码内射| www亚洲精品| 91精品久久久久| 日韩精品综合在线| 久久久亚洲影院| 国产精品视频网站| 亚洲自拍另类欧美丝袜| 青青久久av北条麻妃黑人| 久久综合给合久久狠狠色|