I have an api using the Slim framework (version 3). The project structure has an api directory in the root directory. In it I have dirs for "controllers", "models", "public", "src", etc., as well as my composer.json and vendor (once running composer install). My controllers all have the namespace "App\Controllers" and the composer.json has
"psr-4": {
"App\\": ""
}
defined in autoload. While hitting a route, I am calling my controllers (ex. App\Controllers\AccountController:login). All of this works fine in my vagrant environment, but as soon as I upload it to my production server (shared host and I dropped the entire api dir from my local environment to the public_html dir in the shared host), I get
Type: RuntimeException
Message: Callable App\Controllers\AccountController does not exist
File: /home/downunde/public_html/api/vendor/slim/slim/Slim/CallableResolver.php
Line: 62
#0 /home/downunde/public_html/api/vendor/slim/slim/Slim/CallableResolverAwareTrait.php(45): Slim\CallableResolver->resolve('App\Controllers...')
#1 /home/downunde/public_html/api/vendor/slim/slim/Slim/Route.php(314): Slim\Routable->resolveCallable('App\Controllers...')
#2 /home/downunde/public_html/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(116): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#3 /home/downunde/public_html/api/vendor/slim/slim/Slim/Route.php(297): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#4 /home/downunde/public_html/api/vendor/slim/slim/Slim/App.php(441): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#5 /home/downunde/public_html/api/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(116): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#6 /home/downunde/public_html/api/vendor/slim/slim/Slim/App.php(337): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#7 /home/downunde/public_html/api/vendor/slim/slim/Slim/App.php(298): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#8 /home/downunde/public_html/api/public/index.php(52): Slim\App->run()
#9 {main}
Both servers are apache, PHP v. 5.6. I confirmed it is properly hitting the route, but on the shared host it cannot find my controllers.
composer installon the server where it doesn't work? - Rob Allen