Linux PHP installation mcrypt Extension Module Note _php instance

Source: Internet
Author: User
Tags mcrypt phpinfo zts
System Environment: centOS6.3
apache:httpd-2.4.2
php:php-5.3.21

I. Installation MCrypt

1. Download the Libmcrypt,mhash,mcrypt installation package

Copy the Code code as follows:
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

2. Install Libmcrypt First

Copy the Code code as follows:
# TAR-ZXVF Libmcrypt-2.5.8.tar.gz
# CD libmcrypt-2.5.8
#/usr/local/php5/bin/phpize #动态编译php模块 so that it can be compiled using configure.
#./configure
# make
# make Install # Libmcript is installed by default on/usr/local

3. Installing Mhash

Copy the Code code as follows:
# 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. Installing MCrypt

Copy the Code code as follows:
# 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 instructions after compiling the 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

Copy the Code code as follows:
# Vi/usr/local/php5/lib/php.ini

Add the following line:
Copy the Code code as follows:
Extension = "/usr/local/php5/lib/php/extensions/no-debug-zts-20090626/mcrypt.so"

To restart Apache:
Copy the Code code as follows:
/usr/local/apache2/bin/apachectl restart

6. Add phpinfo function, test page

Add the following info.php to/usr/local/apache2/htdocs/to test if the PHP module is loaded.
Copy the Code code as follows: # vi/usr/local/apache2/htdocs/info.php
---------------
<?php
Echo Phpinfo ();
?>
---------------

Check if port 80 is open
Copy the Code code as follows:
# lsof-i:80

Browser input http://localhost/info.php
Display the following test page content, the Mcrypt.so module is loaded successfully under PHP

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