[PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm
Hello, from two days I have strange problem with this param mbstring.internal_encoding on nginx and php-fpm. I use php version 5.4.20 and when I setting mbstring.internal_encoding I have a problem with mcrypt. NOTICE: PHP message: PHP Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 12, needed: 8 in file.php I setup php.ini file: zend.multibyte = On default_mimetype = text/html default_charset = UTF-8 mbstring.internal_encoding = UTF-8 and here is function: 85 private function decrypt($blob) 86 { 87 $deckey = $_SESSION['key']; 88 $realkey = sha1($deckey, true); 89 $rawblob = hex2bin($blob); /* binary blob */ 90 $td = mcrypt_module_open($this-CIPHER, , MCRYPT_MODE_CFB, ); 91 $iv = mb_substr($rawblob, 0, mcrypt_enc_get_iv_size($td)); /* IV */ 92 if (mb_strlen($iv) mcrypt_enc_get_iv_size($td)) return FALSE; 93 $ct = mb_substr($rawblob, mcrypt_enc_get_iv_size($td)); /* CipherText */ 94--- mcrypt_generic_init($td, $realkey, $iv); 95 $unblob = mdecrypt_generic($td, $ct); 96 mcrypt_generic_deinit($td); 97 $pt = mb_substr($unblob, 20); 98 $check = mb_substr($unblob, 0, 20); 99 if ($check != sha1($pt, true)) 100 { 101 return FALSE; 102 } else { 103 return $pt; 104 } 105 } The same code with the same config options is worked fine with apache httpd. Any one can give me a little help ? Thanks Regards, Hristo S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm
Hristo, Try changing the php.ini config: mbstring.func_overload 0 See if that helps your issue, more on what it does: http://php.net/manual/en/mbstring.overload.php Aziz On Mon, Sep 23, 2013 at 8:23 AM, Condor con...@stz-bg.com wrote: Hello, from two days I have strange problem with this param mbstring.internal_encoding on nginx and php-fpm. I use php version 5.4.20 and when I setting mbstring.internal_encoding I have a problem with mcrypt. NOTICE: PHP message: PHP Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 12, needed: 8 in file.php I setup php.ini file: zend.multibyte = On default_mimetype = text/html default_charset = UTF-8 mbstring.internal_encoding = UTF-8 and here is function: 85 private function decrypt($blob) 86 { 87 $deckey = $_SESSION['key']; 88 $realkey = sha1($deckey, true); 89 $rawblob = hex2bin($blob); /* binary blob */ 90 $td = mcrypt_module_open($this-**CIPHER, , MCRYPT_MODE_CFB, ); 91 $iv = mb_substr($rawblob, 0, mcrypt_enc_get_iv_size($td)); /* IV */ 92 if (mb_strlen($iv) mcrypt_enc_get_iv_size($td)) return FALSE; 93 $ct = mb_substr($rawblob, mcrypt_enc_get_iv_size($td)); /* CipherText */ 94--- mcrypt_generic_init($td, $realkey, $iv); 95 $unblob = mdecrypt_generic($td, $ct); 96 mcrypt_generic_deinit($td); 97 $pt = mb_substr($unblob, 20); 98 $check = mb_substr($unblob, 0, 20); 99 if ($check != sha1($pt, true)) 100 { 101 return FALSE; 102 } else { 103 return $pt; 104 } 105 } The same code with the same config options is worked fine with apache httpd. Any one can give me a little help ? Thanks Regards, Hristo S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with mbstring.internal_encoding, mcrypt and php-fpm
On 2013-09-23 15:42, Aziz Saleh wrote: Hristo, Try changing the php.ini config: mbstring.func_overload 0 See if that helps your issue, more on what it does: http://php.net/manual/en/mbstring.overload.php [3] Aziz On Mon, Sep 23, 2013 at 8:23 AM, Condor con...@stz-bg.com wrote: Hello, from two days I have strange problem with this param mbstring.internal_encoding on nginx and php-fpm. I use php version 5.4.20 and when I setting mbstring.internal_encoding I have a problem with mcrypt. NOTICE: PHP message: PHP Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 12, needed: 8 in file.php I setup php.ini file: zend.multibyte = On default_mimetype = text/html default_charset = UTF-8 mbstring.internal_encoding = UTF-8 and here is function: 85 private function decrypt($blob) 86 { 87 $deckey = $_SESSION['key']; 88 $realkey = sha1($deckey, true); 89 $rawblob = hex2bin($blob); /* binary blob */ 90 $td = mcrypt_module_open($this-CIPHER, , MCRYPT_MODE_CFB, ); 91 $iv = mb_substr($rawblob, 0, mcrypt_enc_get_iv_size($td)); /* IV */ 92 if (mb_strlen($iv) mcrypt_enc_get_iv_size($td)) return FALSE; 93 $ct = mb_substr($rawblob, mcrypt_enc_get_iv_size($td)); /* CipherText */ 94 --- mcrypt_generic_init($td, $realkey, $iv); 95 $unblob = mdecrypt_generic($td, $ct); 96 mcrypt_generic_deinit($td); 97 $pt = mb_substr($unblob, 20); 98 $check = mb_substr($unblob, 0, 20); 99 if ($check != sha1($pt, true)) 100 { 101 return FALSE; 102 } else { 103 return $pt; 104 } 105 } The same code with the same config options is worked fine with apache httpd. Any one can give me a little help ? Thanks Regards, Hristo S. Hello, I just try and no effect after reload the php-fpm. Regards, Hristo S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php