-1
       $key = '6yOFZuQis%7$oF_[M89=EV!a}\mzb7=B';
       $iv = 'Fa)=zx"h^O8t.-s4nO-q#vTp,,ft;fCj';

       $data = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, serialize($data), MCRYPT_MODE_CBC, $iv);
       $data=base64_encode($data);

above code works in localhost without any errors with encrypted value.but while uploading line number 3 ($data=mcrypt) shows error as

Fatal error: Call to undefined function mcrypt_encrypt() in demo.php on line 3..... i cant understand what is the error.I googled about it but i didnt get answer.

Charles
  • 50,943
  • 13
  • 104
  • 142
avks
  • 1
  • 1
  • 4
  • Protip: **Read the error message**. Does it say anything about base64? Nope, it's complaining about [`mcrypt_encrypt`](http://php.net/mcrypt_encrypt) being missing. – Charles Feb 20 '14 at 08:43

1 Answers1

3

Check this with your host if PHP mcrypt library is installed or not. If you have root access to your server, run the following command:

yum install php-mcrypt

24x7servermanagement
  • 2,520
  • 1
  • 13
  • 11