How To Install mcrypt For PHP53 On CentOS

Published Date Author: , Posted August 12th, 2011 at 1:43:55pm

To get mcrypt support for PHP 5.3, compile and install just the mcrypt extension.

First, get the prerequisites:

Download the php source code from php.net, for example:

Now, cd to the proper place and follow these steps:

Create the configuration file for MCrypt /etc/php.d/mcrypt.ini containing:

Restart apache:

Create a file with phpinfo just to check if the extension was loaded:

Comments reader  2 Reader Comments

Eric Stone | Eric M. Stone | Eric Michael Stone | Random Thoughts, Whims and Fancies - Gravatar

www.ericmichaelstone.com/?p=4775 Eric Stone | Eric M. Stone | Eric Michael Stone | Random Thoughts, Whims and Fancies said on August 22, 2011, 2:39 pm:

[…] To get mcrypt installed, read this post: http://www.ericmichaelstone.com/?p=4702 […]

Daniel - Gravatar

Daniel said on August 31, 2011, 5:28 pm:

Eric,
I recently upgraded to php 5.3.3 on my Centos 5.6.
I tried following your instructions however I cant get past by ./configure.

Heres what I get, Hope you can help me out. Thanks

[root@s15430664 ~]# cd php-5.3.6/ext/mcrypt/
[root@s15430664 mcrypt]# phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
[root@s15430664 mcrypt]# aclocal
configure.in:8: warning: LT_AC_PROG_SED is m4_require’d but is not m4_defun’d
configure.in:8: LT_AC_PROG_SED is required by…
acinclude.m4:2683: PHP_CONFIG_NICE is expanded from…
configure.in:8: the top level
[root@s15430664 mcrypt]# ./configure
checking for egrep… grep -E
checking for a sed that does not truncate output… /bin/sed
checking for cc… cc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether cc accepts -g… yes
checking for cc option to accept ANSI C… none needed
checking how to run the C preprocessor… cc -E
checking for icc… no
checking for suncc… no
checking whether cc understands -c and -o together… yes
checking for system library directory… lib
checking if compiler supports -R… no
checking if compiler supports -Wl,-rpath,… yes
checking build system type… x86_64-redhat-linux-gnu
checking host system type… x86_64-redhat-linux-gnu
checking target system type… x86_64-redhat-linux-gnu
checking for PHP prefix… /usr
checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory… /usr/lib64/php/modules
checking for PHP installed headers prefix… /usr/include/php
checking if debug is enabled… no
checking if zts is enabled… no
checking for re2c… no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk… gawk
checking for mcrypt support… yes, shared
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
[root@s15430664 mcrypt]# make
make: *** No targets specified and no makefile found. Stop.
[root@s15430664 mcrypt]# make install
make: *** No rule to make target `install’. Stop.
[root@s15430664 mcrypt]#

erics - Gravatar

www.wyzaerd.com erics said on August 31, 2011, 5:47 pm:

Looks like you need to install libmcrypt with yum or apt-get…

Leave Your Comment  Leave a comment

All fields marked with "*" are required.