Building a php extension using phpize

Run piece of PHP code in command line

php -r "echo(mcrypt_module_open('rijndael-256', '', 'ofb', ''));"

Then got an error message about Mcrypt:

Fatal error: Call to undefined function mcrypt_module_open() in Command line code on line 1

Install mcrypt for PHP53 on centos by phpize

cd php-5.5.9/ext/mcrypt/
phpize
aclocal
./configure
make
make install

Add the myrypt extension config /etc/php.ini containing:

extension=mcrypt.so

And check if the mcrypt module loaded or not by php -m | grep "mcrypt".

You may get some errors like the following

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - libmcrypt.so.4: cannot open shared object file: No such file or directory in Unknown on line 0

To fix it, enter yum install libmcrypt-devel