note 117047 deleted from function.mcrypt-create-iv by cmb

From: Date: Mon, 27 Jul 2015 17:02:50 +0000
Subject: note 117047 deleted from function.mcrypt-create-iv by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203194@lists.php.net to get a copy of this message
Note Submitter: Cory Christison ---- Just a note to those who would like to use PHP-FPM with their pool in a Chroot. Unfortunately, you cannot get access to the /dev/ filesystem if you are chrooted in your web path (/home/user/, or /var/www/, etc). In order to make your code more portable, you can chain multiple sources in your code. For example: <?php $cipher = MCRYPT_RIJNDAEL_256; $blockmode = MCRYPT_MODE_CBC; $ivsize = mcrypt_get_iv_size($cipher, $blockmode); $ivdata = mcrypt_create_iv($ivsize, MCRYPT_DEV_URANDOM|MCRYPT_RAND); $key = hash($MyPassword, 'sha256'); echo mcrypt_encrypt($cipher, $key, $data, $blockmode, $ivdata); ?> This will first try to use MCRYPT_DEV_URANDOM, if it is not available, it will try to use MCRYPT_RAND.

« previous php.notes (#203194) next »