Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 4: Dotenv::populate returns none

I am trying to run a Symfony4 app on production and I am getting the following error:

Uncaught TypeError: Return value of Symfony\\Component\\Dotenv\\Dotenv::populate() 
must be an instance of Symfony\\Component\\Dotenv\\void, 
none returned in /var/www/html/vendor/symfony/dotenv/Dotenv.php:95
Stack trace:
#0 /var/www/html/vendor/symfony/dotenv/Dotenv.php(57): 
    Symfony\\Component\\Dotenv\\Dotenv->populate(Array)
#1 /var/www/html/public/index.php(12): 
    Symfony\\Component\\Dotenv\\Dotenv->load('/var/www/html/s...')
#2 {main}
    thrown in /var/www/html/vendor/symfony/dotenv/Dotenv.php on line 95

On local the app is running fine. Once it moves to production, it breaks.

Any idea why this might be happening?

like image 664
apfz Avatar asked Nov 25 '17 15:11

apfz


1 Answers

And is production running PHP5.x, or 7.0? The void return type is only available/reserved from PHP 7.1, and so it would think it could be a class in the same namespace - which does not exist either. Symfony 4 requires PHP 7.1.3

like image 130
Alister Bulman Avatar answered Sep 22 '22 12:09

Alister Bulman