Linux下php5.3.3安裝mcrypt擴展


具體操作:

一、下載軟件包

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

http://pan.baidu.com/s/1mifTbfE

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

http://pan.baidu.com/s/1mifTbfE

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

http://pan.baidu.com/s/1mifTbfE

4、下載mcrypt

http://pan.baidu.com/s/1mifTbfE

或者:

wget http: //downloads .sourceforge.net /project/mcrypt/Libmcrypt/2 .5.8 /libmcrypt-2 .5.8. tar .gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&ts=1430725959&use_mirror=ncu
 
wget http: //downloads .sourceforge.net /project/mcrypt/MCrypt/2 .6.8 /mcrypt-2 .6.8. tar .gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F&ts=1430726021&use_mirror=ncu
 
wget http: //downloads .sourceforge.net /project/mhash/mhash/0 .9.9.9 /mhash-0 .9.9.9. tar .gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F&ts=1430726218&use_mirror=ncu
wget http: //museum .php.net /php5/php-5 .3.3. 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

注意:

tar  zxf php-5.3.3. tar .gz
cd  php-5.3.3 /ext/mcrypt/
/usr/bin/phpize
(這個命令有的話,就可以這樣,若沒有的話,只能下載php5.3.3源碼(http://pan.baidu.com/s/1mifTbfE),進行./configure)
. /configure  --with-php-config= /usr/bin/php-config
make
make  install
 
echo  'extension=mcrypt.so'  /etc/php .d /mcrypt .ini
/etc/init .d /httpd  reload
php -m | grep  'mcrypt'
編譯安裝:

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

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

2、安裝php

cd /usr/local/src

tar zxvf php-5.3.3.tar.gz

cd php-5.3.3

'./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'

這里可以參考之前的已經安裝完的./configure

#在之前的編譯參數后面增加'--with-mcrypt' 回車

make  #編譯

make install  #安裝

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

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

<?php

phpinfo();

?>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM