the following code for file encryption is working perfectly in my local xampp server. But while uploaded and run in aws ec2 server its not working  

`stream_filter_append($fcrypt, 'mcrypt.rijndael-128', STREAM_FILTER_WRITE, $opts)` code. file is not encrypting. How can i solve this issue?

```
$fin = fopen($input_stream, "rb");
$fcrypt = fopen($aes_filename, 'wb');
$opts = array('iv'=>'','key'=>$key, 'mode'=>'ctr');
if(!stream_filter_append($fcrypt, 'mcrypt.rijndael-128', STREAM_FILTER_WRITE, $opts)){
    echo "encryption failed";
    exit;
}else{
    while (!feof($fin))
    {
        fwrite($fcrypt, fread($fin, 8192));
    }
    fclose($fcrypt);
    fclose($fin);
}

```