I have CakePHP installed on a machine with Php 8.2, I just started using Cake and I was having to use Bake, however, whenever I try to run the command it returns this error:
PHP Fatal error: Declaration of Bake\Shell\BakeShell::startup() must be compatible with Cake\Console\Shell::startup(): void in C:\xampp\htdocs\romiseta\vendor\cakephp\bake\src\Shell\BakeShell.php on line 50
Fatal error: Declaration of Bake\Shell\BakeShell::startup() must be compatible with Cake\Console\Shell::startup(): void in C:\xampp\htdocs\romiseta\vendor\cakephp\bake\src\Shell\BakeShell.php on line 50
You seem to be running on an old version of cakephp/bake for some reason.
How did you create your cakephp app? Because the latest version of the cakephp app template doesn’t use bake 1.x (which you seem to use)
Hi, also I have the same error, whene run “bin/cake server” give me this
“Fatal error: Declaration of App\Shell\ConsoleShell::getOptionParser() must be compatible with Cake\Console\Shell::getOptionParser(): Cake\Console\ConsoleOptionParser”
Thx for the replay, but when I try to execute : “bin/cake upgrade rector --rules cakephp42 ” give me this error
PHP Fatal error: Declaration of App\Shell\ConsoleShell::getOptionParser() must be compatible with Cake\Console\Shell::getOptionParser(): Cake\Console\ConsoleOptionParser in myApp\src\Shell\ConsoleShell.php on line 67
Fatal error: Declaration of App\Shell\ConsoleShell::getOptionParser() must be compatible with Cake\Console\Shell::getOptionParser(): Cake\Console\ConsoleOptionParser in myApp\src\Shell\ConsoleShell.php on line 67
PHP Fatal error: Declaration of App\Shell\ConsoleShell::getOptionParser() must be compatible with Cake\Console\Shell::getOptionParser(): Cake\Console\ConsoleOptionParser in myApp\src\Shell\ConsoleShell.php on line 67
and after that give me another error in file ruotes.php at thi line : “Plugin::routes();” cause is deprecated… i have comment this line and I have launch this command
[Notice (1024)](javascript:void(0);): Undefined property: ErrorController::$viewVars in C:…\src\Controller\AppController.php on line 119 [CORE\src\Controller\Controller.php, line 321]
[Warning (512)](javascript:void(0);): Unable to emit headers. Headers sent in file=C:…\vendor\cakephp\cakephp\src\Error\Debugger.php line=971 [CORE\src\Http\ResponseEmitter.php, line 71]
[Warning (2)](javascript:void(0);): Cannot modify header information - headers already sent by (output started at C:…\vendor\cakephp\cakephp\src\Error\Debugger.php:971) [CORE\src\Http\ResponseEmitter.php, line 168]
[Warning (2)](javascript:void(0);): Cannot modify header information - headers already sent by (output started at C:…i\vendor\cakephp\cakephp\src\Error\Debugger.php:971) [CORE\src\Http\ResponseEmitter.php, line 197]
[Warning (2)](javascript:void(0);): Cannot modify header information - headers already sent by (output started at C:…\vendor\cakephp\cakephp\src\Error\Debugger.php:971) [CORE\src\Http\ResponseEmitter.php, line 197]
An Internal Server Error Occurred
I think something it’s not update… or it’s normal to have too many problems?
I’d say look at either the logs/error.log file or the webserver error.log which I can’t tell you where it is positioned because this depends on your webserver config.
But if you now updated to CakePHP 4.4 I’d recommend you check the files present in cakephp/app (and most certainly there are changes needed in your config directory) to see if everything matches up.
Thx for your patience,
I solved the problem about errorhandler, and i found the log of webserver
that’s it:
Request URL: /
2023-08-16 16:38:22 error: [ArgumentCountError] Too few arguments to function Cake\Routing\Middleware\RoutingMiddleware::__construct(), 0 passed in …\vendor\cakephp\cakephp\src\Http\MiddlewareQueue.php on line 80 and at least 1 expected in …\vendor\cakephp\cakephp\src\Routing\Middleware\RoutingMiddleware.php on line 71
Request URL: /
2023-08-16 16:38:23 error: [Cake\View\Exception\MissingTemplateException] Template file Error\error500.php could not be found.
The following paths were searched:
....templates\Error\error500.php
....\vendor\cakephp\cakephp\templates\Error\error500.php
in …\vendor\cakephp\cakephp\src\View\View.php on line 1398
Exception Attributes: array (
‘file’ => ‘Error\error500.php’,
‘paths’ =>
array (
0 => ‘C:\00_Sviluppo\gestionale-ordinitemplates\’,
1 => ‘C:\00_Sviluppo\gestionale-ordini\vendor\cakephp\cakephp\templates\’,
),
)
Request URL: /
I found this plugin “wsssoftware/cakephp-datatables” which promises to do everything I need. I have read all the documentation in the site “Welcome — CakePHP DataTables” but unfortunately I can’t figure out how I can use it.
I have to load a table in the frontend with the paginated data of my Model… but I can’t find examples anywhere and in the documentation it doesn’t explain (or I don’t understand). Does anyone have examples of usage?