博客:http://ju.outofmemory.cn/entry/9241
安裝php的mcrypt擴展(動態加載編譯)
centos中安裝phpize
使用命令
yum install php-devel
然後就會安裝上phpize了
下載php下的mcrypt擴展或者直接下載php的完整安裝包
http://www.php.net/releases/ 網頁下找到自己服務器的php版本,下載後tar解壓(本人的是php5.3.3)
進入ext/mcrypt文件夾
上傳 mcrypt文件夾到你服務器的某個目錄下然後進入此目錄
執行phpize命令(phpize是用來擴展php擴展模塊的,通過phpize可以建立php的外掛模塊,如果沒有?yum install php53-devel裏包含了,或者其他方法)
[root@*_*14:48 mcrypt]# whereis phpize //爲了確定phpize存在
phpize:/usr/bin/phpize /usr/share/man/man1/phpize.1.gz
[root@*_*14:48 mcrypt]# phpize
Configuringfor:
PHP ApiVersion: 20090626
ZendModuleApiNo: 20090626
ZendExtensionApiNo: 220090626
執行完後,會發現當前目錄下多了一些configure文件,最後執行php-config命令就基本完成了
執行以下命令,確保你的/usr/bin/php-config是存在的
[root@*_*15:02 mcrypt]# whereis php-config
php-config:/usr/bin/php-config /usr/share/man/man1/php-config.1.gz
[root@*_*15:02 mcrypt]#./configure --with-php-config=/usr/bin/php-config
如果遇到以下錯誤,請先安裝gcc,命令yum install gcc
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->
configure: error:no acceptable C compiler found in $PATH
直到不報錯,出現:config.status: creating config.h,執行以下命令
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->
[root@*_*15:06 mcrypt]# make && make install
最後的最後,會提示你如下,說明你大功告成了
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->
Installing shared extensions: /usr/lib64/php/modules/
順便檢查下/usr/lib64/php/modules/裏的mrcypt.so擴展是否已經創建成功
然後的事就簡單了,給你的php.ini添加一條extension=mcrypt.so
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->
[root@*_*15:09 mcrypt]# cd /etc/php.d
創建一個mrcypt.ini文件就行,裏面寫extension=mcrypt.so
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->
[root@*_*15:17 php.d]# echo 'extension=mcrypt.so'> mcrypt.ini
(3) 、重啓apache,查閱phpinfo,mcrypt模塊擴展是不是加載了?