I'm running Dovecot + Postfix on my server, and I want PHP to generate e-mail accounts. It all works, except the password. They are using a MySQL-function, but I cannot use it because I use Symfony (at least I think I cannot easily use it)
ENCRYPT('password', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16)))
And I want to 'convert' this function a PHP script. I've tried this, but with no luck:
$fp = fopen('/dev/urandom', 'r');
$randomString = fread($fp, 32);
fclose($fp);
$salt = base64_encode($randomString);
$email->setPassword(crypt($email->getPlainPassword(), '$6$'.$salt));
Thanks in advance, Bart
After more trying, I found this: