Introduction
Hello,
I moved my files from my local pc, running WAMP to my webserver, which is a Linux machine.
I work with composer to use its autoload functionality to load my MVC structure, more about that later.
The error that I receive on my webpage is the following:
Fatal error: Uncaught Error: Class 'App\Model\DB' not found in <folder_structure>/config/_boot.php:15
I do not have this error on my Windows machine, the code works perfectly there.
Folder structure
I use the same folder structure, which is (simplified) as following:
- config
-- _boot.php
- dist
-- index.php
-- includes
--- header.php
- src
-- app
--- Models
---- db.php
- composer.json
Code parts
My config/_boot.php
file looks like this:
use App\Model\DB;
...
$db = new DB($database['host'], $database['dbname'], $database['user'], $database['password']);
My src/app/Model/db.php
file looks like this:
namespace App\Model;
class DB
{
}
My composer.json
contains this:
"autoload": {
"psr-4": {
"App\\": "src/app/"
},
"files": [
"src/app/functions.inc.php",
"config/_boot.php",
"src/app/Routing.php"
]
}
autoload_psr4.php
return array(
...
'App\\' => array($baseDir . '/src/app'),
...
);
Question
Is there anyone who has an idea of what I am doing wrong?
Things I have tried / Checked
- Check the folder permissions
- I tried adding
"App\\Model\\": "src/app/Model/"
to mycomposer.json
as well
PS: This is my first question on Stackoverflow, tips on improving the layout are welcome...