首先check linux是否安裝php-mcrypt module
- ^, l& m# _- [! Q" T5 m3 M- X# [- #rpm -qa | grep php-mcrypt
複製代碼 若無則以yum安裝" M$ r a' d4 A M0 W- `* A7 ]
但它會提示說無php-mcrypt可供安裝,於是執行下列動作:
( z6 _( q( ^: y3 R( D& I( @* ]for CentOS 6.x x86:0 u- q9 G5 U) N# I- ]: o9 f
- # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
+ I) V" v6 d8 a. u! Z - # rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
3 n' |% ^( l3 ~& L9 a4 ~5 s* ] - # wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
( M8 i# n1 }1 j2 X3 o - # rpm -ivh epel-release-6-8.noarch.rpm
複製代碼 * T. i) U, S# `& l% R3 g# n F
for CentOS 6.x x64
# m0 w9 `; `" j& l; `& j- # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
. J, u3 F/ R1 e- X$ d - # rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
2 w7 z+ H0 p, ^5 K& }# U% x - # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
( ^9 R$ C3 `# ^ - # rpm -ivh epel-release-6-8.noarch.rpm
複製代碼 再執行一遍 #yum install php-mcrypt,但這次出現的問題是5 H+ a5 m% G# C$ b/ j0 i
- # yum install php-mcrypt
( }8 s. M C2 u9 ]: u+ ]9 a, I5 r - Loaded plugins: fastestmirror, refresh-packagekit
! ]- }- m: f) p- e - Loading mirror speeds from cached hostfile, W# `% }, t( D* {* Z3 M
- Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
複製代碼 ! P3 L4 c3 ~& p( [5 A
" T; G( p$ i+ L: y於是
$ r9 Q- Y" A+ c& K7 X3 C2 b- #vi etc/yum.repos.d/epel.repo
複製代碼 * m8 }" G. i+ O3 h
將[epel]段下的 baseurl註解掉,並將mirrorlist恢復,如下:
8 }+ h% B' }1 _- P- W7 }baseurl
4 p$ s4 }+ k _- C! Y#mirrorlist
7 m/ R) _7 x2 q$ a& O; W最後再執行一遍 #yum install php-mcrypt,這次終於順利安裝完成,會看到安裝如下的模組
# M6 M6 l/ ?/ D3 I4 l% w& l a
2 B' {- b6 u. B+ G c0 M
2 j; @% J" N3 j, Q: b
+ y) T: J% G+ k+ m4 H且apache需restart,php-mcrypt module才會發生作用 |
|