An analysis of PHP installation extension mcrypt and related dependencies (method of PHP installation pecl extension) _php tutorial

Source: Internet
Author: User
Tags mcrypt phpinfo
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): Click link
MCrypt (mcrypt-2.6.8.tar.gz): Click link
Mhash (mhash-0.9.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
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 Libmcrypt's link library could not be found when configuring MCrypt, it could not be compiled because the Libmcrypt link library is under the/usr/local/lib folder.
For the time being, when configuring MCrypt, add Ld_library_path=/usr/local/lib to 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.


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

http://www.bkjia.com/PHPjc/328064.html www.bkjia.com true http://www.bkjia.com/PHPjc/328064.html techarticle One: MCrypt introduction mcrypt is an extension of PHP, which completes the encapsulation of common cryptographic algorithms. In fact, the extension is the MCrypt Standard Class library encapsulation, MCrypt completed a considerable number of commonly used encryption algorithm ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.