首先check linux是否安裝php-mcrypt module
- J" r2 b" P7 Y3 w2 @" H7 s6 t6 m- n- #rpm -qa | grep php-mcrypt
複製代碼 若無則以yum安裝; M( R, t' b# ~$ _# O0 c
但它會提示說無php-mcrypt可供安裝,於是執行下列動作:% t0 P+ i4 _# ?; O) z2 x
for CentOS 6.x x86:: J! M/ f2 m; y) B R) _! Q
- # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
5 G9 _. O9 a" |7 q - # rpm -ivh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
1 @1 y: s" {+ P; E - # wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm6 U/ C1 b5 Z6 A O
- # rpm -ivh epel-release-6-8.noarch.rpm
複製代碼
1 z+ d9 L0 S; z# S* }: xfor CentOS 6.x x64
" \2 Q) M/ U/ q3 @' k% n( D! U- m- # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm; }4 J$ w3 S8 o6 {
- # rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
! m; c: x+ ? g. `. U ^4 } - # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm* t- V4 I `3 B' q
- # rpm -ivh epel-release-6-8.noarch.rpm
複製代碼 再執行一遍 #yum install php-mcrypt,但這次出現的問題是5 n( s" l$ l( ~
- # yum install php-mcrypt
6 q* T$ e1 p( z+ L5 v - Loaded plugins: fastestmirror, refresh-packagekit
+ I s- E3 y9 M/ \+ {3 O - Loading mirror speeds from cached hostfile' g- H- A& i2 F
- Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
複製代碼 2 v4 D+ F% b( T5 [0 k$ r
: ~7 v6 ^6 _+ I6 O* n, e
於是
; f# ^! {- G9 M$ q- #vi etc/yum.repos.d/epel.repo
複製代碼
/ I+ z3 v4 ], W) }8 O8 y' F將[epel]段下的 baseurl註解掉,並將mirrorlist恢復,如下:
% e$ |6 M1 j) L# X* L: Kbaseurl
5 k+ ~) x$ A/ R. v4 k5 @0 _#mirrorlist3 @1 d; ~6 z' H. d. t r
最後再執行一遍 #yum install php-mcrypt,這次終於順利安裝完成,會看到安裝如下的模組4 q3 F! P: L9 p) n
/ y7 w3 H! L2 W/ p! Y# h
# h! h* L) D& R5 d& }2 C q d6 b6 T n; C
且apache需restart,php-mcrypt module才會發生作用 |
|