A: MCrypt introduction
MCrypt is an extension of PHP that completes the encapsulation of commonly used cryptographic algorithms. In fact, the extension is the MCrypt Standard Class library encapsulation, MCrypt completed a considerable number of commonly used cryptographic algorithms, such as DES, TripleDES, Blowfish (default), 3-way, safer-sk64, safer-sk128, Twofish , TEA, RC2 and GOST encryption algorithms, and provides a model of CBC, OFB, CFB, and ECB four block encryption.
Two: Install Libmcrypt dependent Library
To use this extension, you must first install the MCrypt Standard Class library, noting that the MCrypt software relies on Libmcrypt and mhash two libraries.
1. Download the Libmcrypt,mhash,mcrypt installation package
Libmcrypt (libmcrypt-2.5.8.tar.gz): http://sourceforge.net/project/showfiles.php?group_id=87941&package_id= 91774&release_id=487459
MCrypt (mcrypt-2.6.8.tar.gz): http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91948 &release_id=642101
Mhash (mhash-0.9.9.9.tar.gz): http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300 &release_id=645636
2. Install Libmcrypt First
#tar-ZXVF libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make Install
Description: Libmcript is installed by default on/usr/local
Restart the machine after installation
3. Re-install Mhash
#tar-ZXVF mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make Install
4. Final installation of MCrypt
#tar-ZXVF mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH =/usr/local/lib./configure
#make
#make Install
Description: Because the Libmcrypt link library could not be found when configuring MCrypt, or the link library for Mhash could not be found, it could not be compiled because the Libmcrypt link library is under the/usr/local/lib folder.
Because of this, to join Ld_library_path=/usr/local/lib when configuring MCrypt, (Ensure that Mhash and libmcrypt libraries are in this folder) import the key library.
Three. Install the PHP pecl extension mcrypt
Note that MCrypt is PHP's own pecl extension, so just go to PHP to extract the directory to find the MCrypt package.
This is different from PHP installation of third-party extensions, refer to PHP installation and use vld view opcode code "PHP installation third-party extension method"
1. Dynamic loading
The common use of PHP is: Compile php forget to add an extension, and then want to add extensions, but because after installing PHP and then loaded with something such as pear, do not want to reload the entire PHP, so you can use dynamic compilation, using Phpize. It is important to note that there are PHP compression packages that are identical to the existing PHP .
#cd/usr/php-5.4.8/ext/mcrypt
#/usr/local/webserver/php/bin/phpize
#./configure--with-php-config=/usr/local/webserver/php/bin/php-config
#make && make Install
Add a extension=mcrypt.so to your php.ini
Restart Apache
#/usr/local/apache2/bin/apachectl Restart
View Phpinfo (), MCrypt and installation
Installation Complete
--------------------------
2. Static compilation
Add the function phpinfo () to any PHP file to get the current PHP configuration
Add the required configuration after these configurations:--with-mcrypt--with-mhash
Then go to the PHP source directory make clean (required), and then execute this full configure command, in turn
Make
Make install
Add the desired configuration to your needs, for example:
./configure--with-apxs2=/usr/local/web/apache/bin/apxs--with-mcrypt--with-mhash
./configure--with-apxs2=/usr/local/web/apache/bin/apxs--with-mcrypt--with-mhash--with-libxml-dir-- Enable-bcmath--enable-sockets
PHP installation extension MCrypt and related dependencies "How to install pecl Extensions in PHP"