note 117047 added to function.mcrypt-create-iv

From: Date: Tue, 07 Apr 2015 16:17:30 +0000
Subject: note 117047 added to function.mcrypt-create-iv
Groups: php.notes 
Request: Send a blank email to php-notes+get-202197@lists.php.net to get a copy of this message
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. ---- Server IP: 72.52.91.14 Probable Submitter: 70.64.201.187 ---- Manual Page -- http://php.net/manual/en/function.mcrypt-create-iv.php Edit -- https://master.php.net/note/edit/117047 Del: integrated -- https://master.php.net/note/delete/117047/integrated Del: useless -- https://master.php.net/note/delete/117047/useless Del: bad code -- https://master.php.net/note/delete/117047/bad+code Del: spam -- https://master.php.net/note/delete/117047/spam Del: non-english -- https://master.php.net/note/delete/117047/non-english Del: in docs -- https://master.php.net/note/delete/117047/in+docs Del: other reasons-- https://master.php.net/note/delete/117047 Reject -- https://master.php.net/note/reject/117047 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202197) next »