Analysis of PHP installation extension mcrypt and related dependencies (the method for installing PECL extension in PHP ). I. Mcrypt introduction Mcrypt is an extension of PHP, which encapsulates common encryption algorithms. In fact, this extension is the encapsulation of the standard mcrypt class library, and mcrypt has completed many common encryption algorithms.
I. INTRODUCTION to Mcrypt
Mcrypt is an extension of PHP and encapsulates common encryption algorithms. In fact, the extension is the encapsulation of mcrypt standard class library, mcrypt completed a lot of common encryption algorithms, such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST encryption algorithms, and provides four block encryption models: CBC, OFB, CFB, and ECB.
II. 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 libmcrypt and mhash libraries.
1. download the Libmcrypt, mhash, and mcrypt installation packages.
Libmcrypt(libmcrypt-2.5.8.tar.gz ):Click link
Mcrypt(mcrypt-2.6.8.tar.gz ):Click link
Mhash(mhash-0.9.9.tar.gz ):Click link
2. install Libmcrypt first
# Tar-zxvf libmcrypt-2.5.8.tar.gz
# Cd libmcrypt-2.5.8
#./Configure
# Make
# Make install
Note: libmbench is installed on/usr/local by default.
Restart the machine after installation.
3. install mhash again.
# 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 Mcrypt is configured, the libmcrypt link library cannot be found, resulting in compilation failure because the Libmcrypt link library is in the/usr/local/lib folder.
For this reason, LD_LIBRARY_PATH =/usr/local/lib must be added when mcrypt is configured to import the key Library.
3. install the Pecl extension mcrypt of PHP
Note that mcrypt is the Pecl extension of PHP, so you only need to find the mcrypt package in the decompressed directory of PHP.
1. dynamic loading
A common problem with using php is: I forgot to add an extension when compiling php, but I want to add another extension later. but I didn't want to reinstall the entire php because I installed something like PEAR after installing PHP, therefore, you can use dynamic compilation and phpize. Note that there must be a php compressed package 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 an extension = mcrypt. so to your php. ini file.
Restart apache
#/Usr/local/apache2/bin/apachectl restart
View phpinfo (), mcrypt, and install
Installation complete
--------------------------
2. Static Compilation
Add the phpinfo () function to any PHP file to obtain the current PHP configuration.
Add the configuration to be added after these configurations: -- with-mcrypt -- with-mhash
Enter the php source code directory make clean (required), and then execute the complete configure command
Make
Make install
Add the configuration as needed, 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
Encryption Mcrypt is an extension of PHP and encapsulates common encryption algorithms. In fact, this extension is the encapsulation of the standard mcrypt class library. mcrypt has completed many common encryption algorithms...