Linux下php安裝mcrypt擴充____Linux

來源:互聯網
上載者:User

說明:

作業系統:CentOS 5.x 64位

已安裝php版本:php-5.4.4

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

實現目的:

在不影響網站訪問的情況下,重新編譯php,增加對mcrypt擴充的支援

具體操作:

一、下載軟體包

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

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  #進入軟體包存放目錄

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

cd libmcrypt-2.5.8  #進入安裝目錄

./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  #添加環境變數

./configure

make

make install

三、重新編譯php

1、查看系統之前安裝的php編譯參數

系統營運  www.osyunwei.com  溫馨提醒:qihang01原創內容 著作權,轉載請註明出處及原文連結

/usr/local/php/bin/php -i |grep configure  #查看php編譯參數,記錄下編譯參數,後面會用到

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'

#在之前的編譯參數後面增加'--with-mcrypt' 斷行符號

make  #編譯

make install  #安裝

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

四、測試mcrypt擴充是否已安裝成功

在網站目錄下建立一個info.php測試頁面,寫上下面代碼,儲存

<?php

phpinfo();

?>

在瀏覽器中開啟info.php 會看到如下的資訊

說明mcrypt擴充已經安裝成功

至此,Linux下php安裝mcrypt擴充完成。       » 本文連結: http://www.osyunwei.com/archives/7421.html » 訂閱本站: http://www.osyunwei.com/feed » 轉載請註明來源: 系統營運 »  Linux下php安裝mcrypt擴充 http://www.osyunwei.com/archives/7421.html

聯繫我們

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