How to add the mcrypt extension module to PHP in CentOS

Source: Internet
Author: User
Tags mcrypt phpinfo zts centos

 

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.

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.