N
N
Nazir Khusnutdinov2016-03-24 16:04:49
symfony
Nazir Khusnutdinov, 2016-03-24 16:04:49

Symfony 3.0.3 How to resolve "There is no suitable CSPRNG installed on your system" error?

Hi all! Need help fixing the error. Maybe someone came across.
Couldn't pinpoint exactly at what point (updating the sources to the latest version and/or manipulating the server and/or updating Symfony) this error appeared, but I noticed that everything worked fine before clearing the cookies.

Twig_Error_Runtime in classes.php line 4797:
An exception has been thrown during the rendering of a template ("There is no suitable CSPRNG installed on your system") in "UserBundle:Security:login_inline.html.twig" at line 45.

Actually line 45:
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />

Moreover, the old version of the sources in prod works on the same server with the same line .
Everything is done as described here
Google? Yes. Did you clear the cache? Yes.
CentOS Linux release 7.2.1511 (Core)
$ uname -a
Linux ovvio.pro 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ php - v
PHP 5.6.19 (cli) (built: Mar 4 2016 23:38:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7. 0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

ZYZH I will continue to look for a solution to the problem myself, but if you respond, I will be very grateful.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rikcon, 2016-03-24
@Naziron

php.net/manual/ru/function.random-bytes.php
This is the function he wants, but it is only in PHP7.
The author of the "paragonie/random_compat" package seems to have broken it a bit.
In composer.json
instead of "paragonie/random_compat": "1.3.*"
fallback to "paragonie/random_compat": "1.2.*"
or try installing php5-mbstring if you don't already have it.

Q
Quber, 2016-09-25
@Quber

This solution doesn't work for everyone. It helped me by adding the path "/dev/urandom" to open_basedir

<VirtualHost localhost:80>
    php_admin_value open_basedir "/dev/urandom:."
</VirtualHost>

Read the solution here https://github.com/paragonie/random_compat/issues/99

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question