System environment: centOS6.3
APACHE: httpd-2.4.2
PHP: php-5.3.21
1. Install mcrypt
1. Download the Libmcrypt, mhash, and mcrypt installation packages.
Libmcrypt-2.5.8.tar.gz
# Wget http://sourceforge.net/project/showfiles.php?
Group_id = 87941 & package_id = 91774 & release_id = 487459
Mhash-0.9.9.tar.gz
# Wget http://sourceforge.net/project/showfiles.php?
Group_id = 4286 & package_id = 4300 & release_id = 645636
Mcrypt-2.6.8.tar.gz
# Wget http://sourceforge.net/project/showfiles.php?
Group_id = 87941 & package_id = 91948 & release_id = 642101 & nbsp;
2. Install Libmcrypt first
# Tar-zxvf libmcrypt-2.5.8.tar.gz
# Cd libmcrypt-2.5.8
#/Usr/local/php5/bin/phpize # dynamically compile the php module so that it can be compiled using configure.
#./Configure
# Make
# Make install # libmbench is installed in/usr/local by default #
3. Install mhash
# Tar-zxvf mhash-0.9.9.9.tar.gz
# Cd mhash-0.9.9.9
#/Usr/local/php5/bin/phpize
#./Configure
# Make
# Make install
4. Install mcrypt
# Tar-zxvf mcrypt-2.6.8.tar.gz
# Cd mcrypt-2.6.8
#/Usr/local/php5/bin/phpize
#./Configure -- with-php-config =/usr/local/php5/bin/php-config
# Make
# Make install
After installation, follow the prompts after compilation and installation.
The mcrypt. so module is saved in the/usr/local/php5/lib/php/extensions/no-debug-zts-20090626/directory by default.
5. Load the module to php
# Vi/usr/local/php5/lib/php. ini
Add the following lines:
Extension = "/usr/local/php5/lib/php/extension/ no-debug-zts-20090626/mcrypt. so"
Restart apache:
/Usr/local/apache2/bin/apachectl restart
6. Added the phpinfo function to the test page.
Add info. php to/usr/local/apache2/htdocs/to test whether the php module is loaded.
# Vi/usr/local/apache2/htdocs/info. php
---------------
<? Php
Echo phpinfo ();
?>
---------------
Check whether port 80 is enabled
# Lsof-I: 80
Enter http: // localhost/info. php in the browser
The following test page is displayed. The mcrypt. so module is successfully loaded under PHP.
Now we can see that the mcrypt extension module has been added when we use phpinfo () to view it.