A brief analysis of PHP installation extension mcrypt and related dependencies (how to install PECL extension in PHP)_PHP tutorial

WBOY
Release: 2016-07-21 15:00:35
Original
785 people have browsed it

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. .


1. Dynamic loading
A common problem when using php is: you forget to add an extension when compiling php, and later you want to add the extension, but you installed it again after installing php For some things such as PEAR, etc., if you don’t want to reinstall the entire PHP, you can use dynamic compilation and use phpize. It should be noted that there must be a php compressed package that is exactly the same as 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

Restart apache
# /usr/local/apache2/bin/apachectl restart
Check phpinfo(), mcrypt and install it
Installation completed
------------ ----------------
2. Static compilation
Add the function phpinfo() to any PHP file to obtain the current PHP configuration
Add the configurations that need to be added after these configurations: --with-mcrypt --with-mhash
Then enter the php source code directory make clean (must be required), and then execute this complete configure command, in order

make
make install
Add the required configuration according 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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328064.htmlTechArticle1: 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...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template