Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

mcrypt

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
like image 223
Matthew 'mandatory' Bryant Avatar asked Jan 01 '14 19:01

Matthew 'mandatory' Bryant


2 Answers

You may have to enable the module. On Ubuntu systems this can most easily be done by linking the ini file that ships with php5-mcrypt into your conf.d for each PHP binary you want to use:

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cli/conf.d/mcrypt.ini
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/cgi/conf.d/mcrypt.ini
like image 150
Chris Avatar answered Nov 09 '22 16:11

Chris


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.

like image 26
John WH Smith Avatar answered Nov 09 '22 14:11

John WH Smith