Fatal error : Uncaught Error: Class ‘controller’ not found in /home/vol6_8/epizy.com/epiz_24477343/htdocs/controllers/homeController.php:2 Stack trace: #0 /home/vol6_8/epizy.com/epiz_24477343/htdocs/index.php(7): require_once() #1 [internal function]: {closure}(‘homeController’) #2 /home/vol6_8/epizy.com/epiz_24477343/htdocs/core/Core.php(36): spl_autoload_call(‘homeController’) #3 /home/vol6_8/epizy.com/epiz_24477343/htdocs/index.php(16): Core->run() #4 {main} thrown in /home/vol6_8/epizy.com/epiz_24477343/htdocs/controllers/homeController.php on line 2
I think your issue could be with your autoloader. Most likely what is happening is that the homeController class file is being loaded BEFORE the controller file therefore meaning that the homeController class can’t detect the controller.
tl;dr: most likely your autoloader is causing this
The autoloader and homeController look fine to me. But is the file that contains the base class controller also present and loaded?
Taking a quick look in your account, I see there is a file Controller.php, but not controller.php.
So please note that our servers, like almost all servers, run on Linux and that file and directory names on Linux are case sensitive (unlike on Windows and MacOS).
The class name is controller and the file is Controller.php
<?php
class controller {
protected $db;
protected $lang;
public function __construct() {
global $config;
$this->lang = new Language();
}
public function loadView($viewName, $viewData = array()) {
extract($viewData);
include 'views/'.$viewName.'.php';
}
public function loadTemplate($viewName, $viewData = array()) {
include 'views/template.php';
}
public function loadViewInTemplate($viewName, $viewData) {
extract($viewData);
include 'views/'.$viewName.'.php';
}
}
Exactly. But your autoloader looks for controller.php, not Controller.php. And while on your local XAMPP stack those files would be the same (because Windows), on most servers, including ours, they are not.
I’m not sure it’s a .htaccess issue. It looks more like an issue with the authentication setup. Remember: you normally want to enforce authentication for every page EXCEPT for login pages and the like.
I don’t validate authentication on the login screen, I’m calling the view login and it seems to give an error, but I don’t know why, if I take it out and leave it to open the home it opens normal