I read the upgrade cake5 guide. I upgraded from 4.5 → 5.0 and had this error when trying to bake a model
ubuntu@ip-172-31-5-93:/var/www/html/test1$ bin/cake bake model -v --no-test --no-fixture Areas
PHP Fatal error: Uncaught Error: Call to undefined function env() in /var/www/html/test1/config/app.php:20
Stack trace:
#0 /var/www/html/test1/vendor/cakephp/cakephp/src/Core/Configure/Engine/PhpConfig.php(84): include()
#1 /var/www/html/test1/vendor/cakephp/cakephp/src/Core/Configure.php(346): Cake\Core\Configure\Engine\PhpConfig->read()
#2 /var/www/html/test1/config/bootstrap.php(83): Cake\Core\Configure::load()
#3 /var/www/html/test1/vendor/cakephp/cakephp/src/Http/BaseApplication.php(183): require_once('...')
#4 /var/www/html/test1/src/Application.php(69): Cake\Http\BaseApplication->bootstrap()
#5 /var/www/html/test1/vendor/cakephp/cakephp/src/Console/CommandRunner.php(190): App\Application->bootstrap()
#6 /var/www/html/test1/vendor/cakephp/cakephp/src/Console/CommandRunner.php(137): Cake\Console\CommandRunner->bootstrap()
#7 /var/www/html/test1/bin/cake.php(12): Cake\Console\CommandRunner->run()
#8 {main}
thrown in /var/www/html/test1/config/app.php on line 20
After troubleshooting, I found that I needed to update the bootstrap.php
file with this line
/**
* Load global functions.
*/
require CAKE . 'functions.php';
Shouldn’t this be done using the upgrade tool ?