gdufo

           

          Linux下php安裝mcrypt擴(kuò)展

          說(shuō)明:

          操作系統(tǒng):CentOS 5.x 64位

          已安裝php版本:php-5.4.4

          已安裝php路徑:/usr/local/php

          實(shí)現(xiàn)目的:

          在不影響網(wǎng)站訪問(wèn)的情況下,重新編譯php,增加對(duì)mcrypt擴(kuò)展的支持

          具體操作:

          一、下載軟件包

          1、下載php版本要與系統(tǒng)安裝的一致

          http://museum.php.net/php5/php-5.4.4.tar.gz

          2、下載libmcrypt安裝mcrypt需要此軟件包

          http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

          3、下載mhash安裝mcrypt需要此軟件包

          https://acelnmp.googlecode.com/files/mhash-0.9.9.9.tar.gz

          4、下載mcrypt

          https://lcmp.googlecode.com/files/mcrypt-2.6.8.tar.gz

          以上軟件包下載之后,上傳到/usr/local/src目錄

          二、安裝軟件包

          1、安裝libmcrypt

          cd /usr/local/src  #進(jìn)入軟件包存放目錄

          tar zxvf libmcrypt-2.5.8.tar.gz  #解壓

          cd libmcrypt-2.5.8  #進(jìn)入安裝目錄

          ./configure  #配置

          make  #編譯

          make install  #安裝

          2、安裝mhash

          cd /usr/local/src

          tar zxvf mhash-0.9.9.9.tar.gz

          cd mhash-0.9.9.9

          ./configure

          make

          make install

          3、安裝mcrypt

          cd /usr/local/src

          tar zxvf mcrypt-2.6.8.tar.gz

          cd mcrypt-2.6.8

          ln -s   /usr/local/bin/libmcrypt_config   /usr/bin/libmcrypt_config  #添加軟連接

          export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH  #添加環(huán)境變量

          ./configure

          make

          make install

          三、重新編譯php

          1、查看系統(tǒng)之前安裝的php編譯參數(shù)

          系統(tǒng)運(yùn)維  www.osyunwei.com  溫馨提醒:qihang01原創(chuàng)內(nèi)容 版權(quán)所有,轉(zhuǎn)載請(qǐng)注明出處及原文鏈接

          /usr/local/php/bin/php -i |grep configure  #查看php編譯參數(shù),記錄下編譯參數(shù),后面會(huì)用到

          2、安裝php

          cd /usr/local/src

          tar zxvf php-5.4.4.tar.gz

          cd php-5.4.4

          './configure' '--prefix=/usr/local/php' '--enable-mbstring=all' '--with-config-file-path=/usr/local/php/etc' '--with-zlib' '--with-mysql=/usr/local/mysql-5.1.38/' '--with-gd' '--with-mysqli=/usr/local/mysql-5.1.38/bin/mysql_config' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-fpm' '--enable-soap' '--with-freetype-dir=/usr/lib64' '--with-iconv=/usr/local' '--with-curl' '--with-mcrypt'

          #在之前的編譯參數(shù)后面增加'--with-mcrypt' 回車(chē)

          make  #編譯

          make install  #安裝

          /usr/local/src/php-5.4.4/sapi/fpm/init.d.php-fpm  reload  #重新加載php-fpm

          四、測(cè)試mcrypt擴(kuò)展是否已安裝成功

          在網(wǎng)站目錄下新建一個(gè)info.php測(cè)試頁(yè)面,寫(xiě)上下面代碼,保存

          <?php

          phpinfo();

          ?>

          在瀏覽器中打開(kāi)info.php 會(huì)看到如下的信息

          說(shuō)明mcrypt擴(kuò)展已經(jīng)安裝成功

          至此,Linux下php安裝mcrypt擴(kuò)展完成。

          posted on 2015-03-19 10:20 gdufo 閱讀(476) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Linux

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(6)

          隨筆分類(lèi)

          隨筆檔案

          文章分類(lèi)

          文章檔案

          收藏夾

          Hibernate

          友情鏈接

          搜索

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 库伦旗| 驻马店市| 九龙坡区| 农安县| 榆社县| 扶风县| 沙洋县| 开封市| 鲜城| 专栏| 嘉兴市| 七台河市| 德清县| 榆林市| 正阳县| 静安区| 西贡区| 全南县| 哈密市| 略阳县| 铁岭县| 右玉县| 电白县| 同江市| 阿图什市| 澄迈县| 香格里拉县| 永宁县| 灌云县| 湖北省| 内丘县| 武冈市| 县级市| 长宁县| 那曲县| 雅江县| 靖远县| 孝义市| 城市| 积石山| 绥阳县|