PHP installation extension mcrypt and related dependencies [how to install PECL extension in PHP]

Source: Internet
Author: User
Tags mcrypt
I. Mcrypt introduction Mcrypt is an extension of PHP, which 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,

I. Mcrypt introduction Mcrypt is an extension of PHP, which 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,

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

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.

This is different from installing third-party extensions in PHP. Refer to PHP installation and use VLD to view opcode. [how to install third-party extensions in 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.It should be noted that there should 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

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.