yii2: yii\base\Security.php -> generateRandomKey() in 2.0.7-dev throws "Unable to generate a random key"

As i could see there is a new Implementation of generateRandomKey(). We end up in base Exception:

Message: Unable to generate a random key
File: vendor/yiisoft/yii2/base/Security.php
Line: 542

Environment:

  • PHP Version 5.5.9-1ubuntu4.9
  • CGI/FastCGI

OpenSSL is enabled:

OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.0.1f 6 Jan 2014
OpenSSL Header Version  OpenSSL 1.0.1f 6 Jan 2014

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (21 by maintainers)

Most upvoted comments

For everybody who did not install php-mcrypt right now (thats why the exception was thrown in my case), http://php.net/manual/de/mcrypt.installation.php:

Linux

apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart