Answer the question
In order to leave comments, you need to log in
How to fix "Unable to generate a random key" error when installing Yii2 on hosting?
An exception occurs "Unable to generate a random key" at basic/vendor/yiisoft/yii2/base/Security.php
If you remove the line in layouts/main.php, everything is displayed, but the problem already occurs on pages with forms.
What could be causing this problem? = Html::csrfMetaTags()
Answer the question
In order to leave comments, you need to log in
Most likely, the legs grow from the check in line 515:
/*510*/ // urandom is a symlink to random on FreeBSD
/*511*/ $device = PHP_OS === 'FreeBSD' ? '/dev/random' : '/dev/urandom';
/*512*/ // Check random device for special character device protection mode. Use lstat()
/*513*/ // instead of stat() in case an attacker arranges a symlink to a fake device.
/*514*/ $lstat = @lstat($device);
/*515*/ if ($lstat !== false && ($lstat['mode'] & 0170000) === 020000) {
/*516*/ $this->_randomFile = fopen($device, 'rb') ?: null;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question