简体   繁体   中英

base64_encode not working and not throwing errors

base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))) ;

I am using the above line to encrypt a string. But some how it is not working. The same code works fine on my pc (i am using wamp server). The problem shows up only when i put it on my linux server which is running php 5.3.27. It does not throw up any errors. The rest of the script after this line is not executed. I commented out this line and the whole script executed perfectly.

Maybe remove the space between ) and ;

base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));

Works fine for me like this:

$key = "testkey";
$test = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));

echo $test;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM