简体   繁体   中英

mcrypt error 404 on EC2

i have a silly problem when migrating from localhost to AWS ec2. nginx web server with php 5.5 and mcrypt installed on both environment.

on localhost crypt function works but on remote server it ends on 404 error page.

some pieces of the code...

called function from the web page:

  $crypt = new crypt();

        // encrypt the 
        // 
        $id='abcdefght';
        $to='12345678';

        $encoded = $crypt->encrypt( $id.','.$to);
        echo $encoded."\n";

crypt class

public function encrypt( $text )
{
    // add end of text delimiter
    $data = mcrypt_encrypt( MCRYPT_RIJNDAEL_256, $this->key, $text, MCRYPT_MODE_ECB, $this->iv );
    return base64_encode( $data );
}

i don't understand if there is some timeout on nginx or if i need to install something more...

thanks for the help

This might be due to some issue preventing the FastCGI server to respond in a reasonable time. Try extending the read timeout and see if the real problem shows.

See Connection timed out while reading response header and Module ngx_http_fastcgi_module .

i have solved using a different function for the crypt...

public  function encrypt($value){ 
if(!$value){return false;}
$text = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv);
return trim($this->safe_b64encode($crypttext)); 
}

this one is running fine without touching the fastCgi timing.

thanks for the support.

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