Reputation: 728
Can anyone tell me what might be the source of this error. I have tried all solutions I found online with no avail. I just installed a cakePHP framework and I am getting this error on index.cpt page...
Error: Fatal error: Class 'AppController' not found in [mypath] on line 2
<?php
class HomeController extends AppController {
function index() {
//nothing's here
}
}
?>
The above is my code...homeController.php and appController.php are on the same folder
Upvotes: 3
Views: 11511
Reputation: 728
This solved my problem after many searching
<?php
namespace App\Controller;
use App\Controller\AppController;
class HomeController extends AppController{
public function index(){
}
}
Upvotes: 4
Reputation: 431
In my case i was getting
Error: Fatal error: Class 'App\Controller\App\Controller' not found in C:\wamp64\www\CakePHP\src\Controller\TestsController.php on line 5
TestsController.php
<?php
namespace App\Controller;
use App\Controller\AppController;
class TestsController extends App**\**Controller {
public function index() {
}
}
?>
Solution: The error was just a silly typing mistake in extends line. it was a "\", in App\Controller; Using AppController instead of App\Controller has resolved the problem.
Upvotes: 0