1

I have a Laravel 9 project which works fine on local, but after uploading it to the online server I get this error :

Fatal error: Uncaught ReflectionException: Class "config" does not exist in /.../vendor/laravel/framework/src/Illuminate/Container/Container.php:875 Stack trace: #0

This project is not in the root folder but inside another folder, because I have multiple laravel projects. The other one laravel 8.8 is working fine.

That's what I've tried so far:

  • delete vender folder and install again
  • delete files in cache folder
  • run command $ php artisan optimize:clear
  • run these commands :
composer install
composer dump-autoload
php artisan cache:clear
php artisan config:clear
  • nothing wrong with my .env file, I just left the default of Laravel
Yu_Jain
  • 111
  • 2
  • 16

2 Answers2

2

I solved this issue. I had some missing php extensions on the server. Installing them solved the issue.

Check the Laravel 9 System Requirements here in their doc.

run this code on your server to see your installed extensions and install everything that is missing.

<?php
echo "<pre>";
print_r(get_loaded_extensions());
echo "<pre/>";
Yu_Jain
  • 111
  • 2
  • 16
0

Remove all the content of bootstrap/cache first:

cd bootstrap/cache/
rm -rf *.php

Then run:

cd ../../
composer dump-autoload
Jason Gilmore
  • 3,698
  • 3
  • 23
  • 28
Dhairya Lakhera
  • 4,445
  • 3
  • 35
  • 62