1: Introduction to Mcrypt
Mcrypt is an extension of PHP that completes the encapsulation of commonly used encryption algorithms. In fact, this extension is an encapsulation of the mcrypt standard class library. mcrypt has completed quite a few commonly used encryption algorithms, such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST encryption algorithm and provides four block encryption models: CBC, OFB, CFB and ECB.
Two: Install the libmcrypt dependent library
To use this extension, you must first install the mcrypt standard class library. Note that the mcrypt software depends on the two libraries libmcrypt and mhash.
1. Download Libmcrypt, mhash, mcrypt installation package
Libmcrypt (libmcrypt-2.5.8.tar.gz): Click the link
mcrypt(mcrypt-2.6.8.tar.gz): Click the link
mhash(mhash-0.9.9.9.tar.gz): Click the link
2. Install Libmcrypt first
#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install
Note: libmcript is installed in /usr/local by default
Restart the machine after installation
3. Then install mhash
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make install
4. Finally install mcrypt
#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local /lib ./configure
#make
#make install
Note: When configuring Mcrypt, the link library of libmcrypt will not be found, resulting in failure to compile, because the link library of Libmcrypt is in /usr/local /lib folder.
For this reason, when configuring mcrypt, add LD_LIBRARY_PATH=/usr/local/lib to import the key library.
3. Install PHP’s Pecl extension mcrypt
Note that mcrypt is PHP’s own Pecl extension, so just go to the PHP decompression directory to find the mcrypt package. .