I have already tried searching for this question and seen a couple of answers, but no luck...
I have composer installed with Slim Framework v3.
I am using autoload for my files using PSR-4 in the composer.json file like this:
"autoload": {
"psr-4": {
"App\\": "App"
}
}
And this is my folder structure:
I am running it on a localhost Mac OS X El-Capitan using Apache 2.4 and everything works like magic. But when I upload it to my Production Linux server (also with Apache 2.4), the autoload seems to be extremely confused and I am getting errors like these:
Warning: include(/home/friendsapp/public_html/vendor/composer/../../app/Middleware/AuthMiddleware.php): failed to open stream: No such file or directory in /home/friendsapp/public_html/vendor/composer/ClassLoader.php on line 412
Warning: include(): Failed opening '/home/friendsapp/public_html/vendor/composer/../../app/Middleware/AuthMiddleware.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/friendsapp/public_html/vendor/composer/ClassLoader.php on line 412
Fatal error: Class 'App\Middleware\AuthMiddleware' not found in /home/friendsapp/public_html/public/index.php on line 5
I have namespaced my classes exactly according to my folder structure.
<?php
namespace App\Middleware;
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
use \App\Middleware\Middleware;
use \App\Share\ErrorCode;
use \App\Models\ResultMessage;
use \App\Mappers\AccessTokenMapper;
class AuthMiddleware extends Middleware {
Any help would be most appreciated! :)