tags:

views:

847

answers:

3

I have a script that uses mcrypt_decrypt() function, but I get the following error

Fatal error: Call to undefined function mcrypt_decrypt()

What modules/libraries do I need to include to use this function? Or is there another reason I'm getting the error?

Thanks

+2  A: 

From the manual:

You need to compile PHP with the --with-mcrypt[=DIR] parameter to enable this extension. DIR is the mcrypt install directory. Make sure you compile libmcrypt with the option --disable-posix-threads.

Generally if PHP says a function is undefined, it means you need to compile in some library.

JW
+4  A: 

Please see:

You need to compile your PHP with --with-mcrypt[=DIR] and have libmcrypt Version 2.5.6 or greater on your machine.

Stefan Gehrig
A: 

sudo apt-get install php5-mcrypt

works on ubuntu.

Ben