Search code examples
configcpanellaravel-9

Class "config" does not exist Laravel 9


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

Solution

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