skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    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/>";
    

  2. Remove all the content of bootstrap/cache first:

    cd bootstrap/cache/
    rm -rf *.php
    

    Then run:

    cd ../../
    composer dump-autoload
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search