Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

joshlittlewood's avatar

Store issues when depolyed

Hi everyone, I have a cart project which works as it should when run locally, but when I deploy it to my digital ocean server through forge I get this error... Fatal error: Uncaught Error: Class 'Store\Models\product' not found in /home/forge/website.com/app/container.php:42.

As far as I can tell I am running the same version of PHP. Anyone know what might be causing this?

Thanks in advance!

0 likes
11 replies
FrancescoZaffaroni's avatar

Check your capitalization, you might have developed on windows that is case insensitive and deployed on a case sensitive environment.

1 like
simondavies's avatar

as @Francesco Zaffaroni says i fell into this at an early stage but where it says Class 'Store\Models\product'check that the filename and classname product is in lowercase otherwise if your server is case sensitive this is more likely the issue.

SO ensure that all mentions of classes etc are the same as the filename and classname regarding capitalisation etc

1 like
FrancescoZaffaroni's avatar

Man jeff should really fix the tagging of users with a white space in the display name

1 like
joshlittlewood's avatar

Ha, that was the problem. I though I had checked that but obviously overlooked capitalisation.

So that is now fixed, but I now get a slim error: Message: Cannot call index on Store\Controllers\HomeController because it is not a class nor a valid container entry

I also get this in my forge failed deployment log: Fatal error: Uncaught Error: Call to a member function make() on integer in /home/forge/website.com/artisan:31 Stack trace: #0 {main} thrown in /home/forge/website.com/artisan on line 31

FrancescoZaffaroni's avatar

It looks like $app in the artisan file is not initialized correctly. are you sure composer install has been run on the server? About the controller I can't help you. No idea.

joshlittlewood's avatar

I am not getting another error!

Cannot call index on Store\Controllers\HomeController because it is not a class nor a valid container entry

I feel like I should be able to fix this fairly simply, but I can't see what is wrong with it.

Thanks

simondavies's avatar

can you post your Store\Controllers\HomeController code or other code so we can see whats happening and to give more to investigate and assits

joshlittlewood's avatar

Here is my HomeContoroller ..

namespace Store\Controllers;

use Slim\Views\Twig; use Store\Models\Product; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request;

class HomeController{ public function index(Request $request, Response $response, Twig $view, Product $product){ $products =$product->get(); return $view->render($response, 'home.twig', [ 'products' => $products ]); } }

simondavies's avatar

To get this straight Are using:

Laravel with forge

or

Slim PHP with forge

Might be best to tag it as forge not laravel?

simondavies's avatar

could it be to with your autoload code etc not being updated, especially since the first issue of capitalisation etc. Also are all files etc uploaded?

Please or to participate in this conversation.