How to Fix “PHP Warning: PHP Startup: mcrypt: Unable to initialize module” on Centos 5

centos5

I found this error message after upgrading PHP 5.1.6 to 5.2.14

# php -v

PHP Warning:  PHP Startup: mcrypt: Unable to initialize module
 Module compiled with module API=20050922, debug=0, thread-safety=0
 PHP    compiled with module API=20060613, debug=0, thread-safety=0
 These options need to match
 in Unknown on line 0
 PHP 5.2.14 (cli) (built: Aug 12 2010 16:03:48)
 Copyright (c) 1997-2010 The PHP Group
 Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

The problem happens when there is a mismatch version of php-mcrypt module with php installed in the server. You can check the version using this command line:

# yum list installed | grep php

...
 php-mbstring.x86_64                  5.2.14-2.el5.art                installed
 php-mcrypt.x86_64                    <strong>5.1.6</strong>-15.el5.centos.1        installed
 php-mysql.x86_64                     5.2.14-2.el5.art                  installed
 ...

To fix this error, we have to update php-mcrypt module:

# yum update php-mcrypt

Leave a Reply

Your email address will not be published. Required fields are marked *