Search code examples
phpcodeignitermcryptcentos6

Php 5.3 mcrypt not working on CentOS 6.3 32-bit


My CodeIgniter application works fine on Amazon EC2 64-bit AMI micro instance thanks to @stormdrain who recommended I install mcrypt to resolve a non-functioning $this->encrypt->decode(...); which was not decrypting my key. Its working now. However, when I copied the same application (using scp) to my local 32-bit machine running CentOS 6.3, I'm getting the same problem ($this->encrypt->decode(...); is not decrypting my key).

So I installed mcrypt sudo yum install php-mcrypt. However, which php-mcrypt and which mcrypt was not found. whereis php-mcrypt and whereis mcrypt turned up nothing. sudo yum php-mcrypt resulted in Package php-mcrypt-5.3.3-1.el6.rf.i686 already installed and latest version. Nothing to do. sudo yum libmcrypt revealed Package libmcrypt-2.5.7-1.2.el6.rf.i686 already installed and latest version. Nothing to do. php --version showed PHP 5.3.3. I searched for mcrypt in the php.ini file but found nothing. echo phpinfo only found one entry besides Additional .ini files parsed: /mcrypt.ini. However, I can't locate this file. The same Encryption Key is already set in CodeIgniter's config.php.

I'm not sure what I'm doing wrong here. Any assistance will be appreciated. Thanks in advance.


Solution

  • This seem to be a issue in the 32bit version of mcrypt when using yum install php-mcrypt to install. Take a look @ Installing php-mcrypt on centos 6.4 (32 bytes) causes problem, the mcrypt.ini file has the wrong entry

    You need to edit /etc/php.d/mcrypt.ini and change

    extension=module.so
    

    To

    extension=mcrypt.so
    

    Then save and restart apache.