Search code examples
phpmcrypt

Call to undefined function mcrypt_decrypt() - even when php5-mcrypt installed


So I can't stop getting the error:

PHP Fatal error:  Call to undefined function mcrypt_decrypt() in 

Even when I have php5_mcrypt installed, I've reinstalled php quite a few times but I can't get it working!

More info:

mandatory@mandatorys-box:~/Desktop/bots$ dpkg -l | grep php
ii  libapache2-mod-php5                       5.5.3+dfsg-1ubuntu2.1                      amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php5                                      5.5.3+dfsg-1ubuntu2.1                      all          server-side, HTML-embedded scripting language (metapackage)
ii  php5-cli                                  5.5.3+dfsg-1ubuntu2.1                      amd64        command-line interpreter for the php5 scripting language
ii  php5-common                               5.5.3+dfsg-1ubuntu2.1                      amd64        Common files for packages built from the php5 source
ii  php5-curl                                 5.5.3+dfsg-1ubuntu2.1                      amd64        CURL module for php5
ii  php5-json                                 1.3.1+dfsg-2                               amd64        JSON module for php5
ii  php5-mcrypt                               5.4.6-0ubuntu3                             amd64        MCrypt module for php5
ii  php5-mysql                                5.5.3+dfsg-1ubuntu2.1                      amd64        MySQL module for php5
ii  php5-readline                             5.5.3+dfsg-1ubuntu2.1                      amd64        Readline module for php5

No idea what the problem is, tried everything.

More info:

mandatory@mandatorys-box:~/Desktop/bots$ php -v
PHP 5.5.3-1ubuntu2.1 (cli) (built: Dec 12 2013 04:24:35) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

Solution

  • Installing is one thing. Enabling is another. Please make sure your /etc/php.ini file contains the following line :

    extension=mcrypt.so
    

    If you can't find your php.ini, create a test.php file containing :

    <?php phpinfo(); ?>
    

    Execute it with php test.php | grep ".ini", and you'll find the paths to your ini files. One of them must include the extension= line above.