skip to Main Content

I am facing a problem of error 500 in my laravel production website.

My application used to work well before a composer update command I ran from ssh to ubuntu server. I used to use forge for deployment and after deploying via ssh I faced this issue.

when I check nginx error logs I get this error:

2021/03/31 09:40:54 [error] 29517#29517: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ReflectionException: Class view does not exist in /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php:833
Stack trace:
#0 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php(833): ReflectionClass->__construct('view')
#1 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php(714): IlluminateContainerContainer->build('view')
#2 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): IlluminateContainerContainer->resolve('view', Array, true)
#3 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php(652): IlluminateFoundationApplication->resolve('view', Array)
#4 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): IlluminateContainerContainer->make('view', Array)
#5 /home/forge/www.itutori...
PHP message: PHP Fatal error:  Uncaught ReflectionException: Class view does not exist in /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php:833
Stack trace:
#0 /home/forge/www.itutorialist.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(833): ReflectionClass->__construct('view')
#1 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php(714): IlluminateContainerContainer->build('view')
#2 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): IlluminateContainerContainer->resolve('view', Array, true)
#3 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Container/Container.php(652): IlluminateFoundationApplication->resolve('view', Array)
#4 /home/forge/my_site/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): IlluminateC

in some of my searches I found maybe the issu is from app.php, so this is my config/app.php file :

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Application Environment
    |--------------------------------------------------------------------------
    |
    | This value determines the "environment" your application is currently
    | running in. This may determine how you prefer to configure various
    | services your application utilizes. Set this in your ".env" file.
    |
    */

    'env' => env('APP_ENV', 'production'),

    /*
    |--------------------------------------------------------------------------
    | Application Debug Mode
    |--------------------------------------------------------------------------
    |
    | When your application is in debug mode, detailed error messages with
    | stack traces will be shown on every error that occurs within your
    | application. If disabled, a simple generic error page is shown.
    |
    */

    'debug' => env('APP_DEBUG', false),

    /*
    |--------------------------------------------------------------------------
    | Application URL
    |--------------------------------------------------------------------------
    |
    | This URL is used by the console to properly generate URLs when using
    | the Artisan command line tool. You should set this to the root of
    | your application so that it is used when running Artisan tasks.
    |
    */

    'url' => env('APP_URL', 'http://localhost'),

    /*
    |--------------------------------------------------------------------------
    | Application Timezone
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default timezone for your application, which
    | will be used by the PHP date and date-time functions. We have gone
    | ahead and set this to a sensible default for you out of the box.
    |
    */

    'timezone' => 'UTC',

    /*
    |--------------------------------------------------------------------------
    | Application Locale Configuration
    |--------------------------------------------------------------------------
    |
    | The application locale determines the default locale that will be used
    | by the translation service provider. You are free to set this value
    | to any of the locales which will be supported by the application.
    |
    */

    'locale' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Application Fallback Locale
    |--------------------------------------------------------------------------
    |
    | The fallback locale determines the locale to use when the current one
    | is not available. You may change the value to correspond to any of
    | the language folders that are provided through your application.
    |
    */

    'fallback_locale' => 'en',

    /*
    |--------------------------------------------------------------------------
    | Encryption Key
    |--------------------------------------------------------------------------
    |
    | This key is used by the Illuminate encrypter service and should be set
    | to a random, 32 character string, otherwise these encrypted strings
    | will not be safe. Please do this before deploying an application!
    |
    */

    'key' => env('APP_KEY'),

    'cipher' => 'AES-256-CBC',

    /*
    |--------------------------------------------------------------------------
    | Autoloaded Service Providers
    |--------------------------------------------------------------------------
    |
    | The service providers listed here will be automatically loaded on the
    | request to your application. Feel free to add your own services to
    | this array to grant expanded functionality to your applications.
    |
    */

    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        IlluminateAuthAuthServiceProvider::class,
        IlluminateBroadcastingBroadcastServiceProvider::class,
        IlluminateBusBusServiceProvider::class,
        IlluminateCacheCacheServiceProvider::class,
        IlluminateFoundationProvidersConsoleSupportServiceProvider::class,
        IlluminateCookieCookieServiceProvider::class,
        IlluminateDatabaseDatabaseServiceProvider::class,
        IlluminateEncryptionEncryptionServiceProvider::class,
        IlluminateFilesystemFilesystemServiceProvider::class,
        IlluminateFoundationProvidersFoundationServiceProvider::class,
        IlluminateHashingHashServiceProvider::class,
        IlluminateMailMailServiceProvider::class,
        IlluminatePaginationPaginationServiceProvider::class,
        IlluminatePipelinePipelineServiceProvider::class,
        IlluminateQueueQueueServiceProvider::class,
        IlluminateRedisRedisServiceProvider::class,
        IlluminateAuthPasswordsPasswordResetServiceProvider::class,
        IlluminateSessionSessionServiceProvider::class,
        IlluminateTranslationTranslationServiceProvider::class,
        IlluminateValidationValidationServiceProvider::class,
        IlluminateViewViewServiceProvider::class,

        IlluminateNotificationsNotificationServiceProvider::class,

        /*
         * Application Service Providers...
         */
        AppProvidersAppServiceProvider::class,
        AppProvidersAuthServiceProvider::class,
        AppProvidersEventServiceProvider::class,
        AppProvidersRouteServiceProvider::class,
        //Custom Service Providers...
        AppProvidersAccessIdServiceProvider::class,
        AppProvidersCategoryServiceProvider::class,
        AppProvidersChannelConfigServiceProvider::class,
        AppProvidersUserListServiceProvider::class,
        AppProvidersGeneralInfoServiceProvider::class,
        AppProvidersMessageServiceProvider::class,
        AppProvidersTutorialServiceProvider::class,
        AppProvidersFileServiceProvider::class,
        AppProvidersUserServiceProvider::class,
        AppProvidersRatingServiceProvider::class,
        AppProvidersReportServiceProvider::class,
        AppProvidersTutorialProviderServiceProvider::class,
        AppProvidersTutorialReviewServiceProvider::class,
        AppProvidersTutorialReviewCommentServiceProvider::class,
        AppProvidersTutorialReviewLikeServiceProvider::class,
        AppProvidersITutorialistRedirectorServiceProvider::class,
        AppProvidersSaveTextsServiceProvider::class,
        AppProvidersFollowServiceProvider::class,
        AppProvidersThreadServiceProvider::class,

        //buzz laravel google captcha
        BuzzLaravelGoogleCaptchaCaptchaServiceProvider::class,

        //Laravel Scout
        LaravelScoutScoutServiceProvider::class,

        //artesaos seotools
        ArtesaosSEOToolsProvidersSEOToolsServiceProvider::class,

        //Bugsnag
        BugsnagBugsnagLaravelBugsnagServiceProvider::class,

        //Laravel Backup
        SpatieBackupBackupServiceProvider::class,

        //Laravelium/laravel-sitemap
        LaraveliumSitemapSitemapServiceProvider::class,

        //jenssegers
        JenssegersAgentAgentServiceProvider::class,

        //laravel socialite
        LaravelSocialiteSocialiteServiceProvider::class,

        //html min
        HTMLMinHTMLMinHTMLMinServiceProvider::class,

        //redirect
        SpatieMissingPageRedirectorMissingPageRedirectorServiceProvider::class,

        //image intervention
        InterventionImageImageServiceProvider::class,

        //laravel Purifier
        MewsPurifierPurifierServiceProvider::class,

        //laravel image optimizer
        SpatieLaravelImageOptimizerImageOptimizerServiceProvider::class,

        //tinker
        LaravelTinkerTinkerServiceProvider::class,

        //tracker
        PragmaRXTrackerVendorLaravelServiceProvider::class,


    ],

    /*
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    */

    'aliases' => [

        'App' => IlluminateSupportFacadesApp::class,
        'Arr' => IlluminateSupportArr::class,
        'Artisan' => IlluminateSupportFacadesArtisan::class,
        'Auth' => IlluminateSupportFacadesAuth::class,
        'Blade' => IlluminateSupportFacadesBlade::class,
        'Broadcast' => IlluminateSupportFacadesBroadcast::class,
        'Bus' => IlluminateSupportFacadesBus::class,
        'Cache' => IlluminateSupportFacadesCache::class,
        'Captcha' => BuzzLaravelGoogleCaptchaCaptcha::class,
        'Carbon' => CarbonCarbon::class,
        'Config' => IlluminateSupportFacadesConfig::class,
        'Cookie' => IlluminateSupportFacadesCookie::class,
        'Crypt' => IlluminateSupportFacadesCrypt::class,
        'DB' => IlluminateSupportFacadesDB::class,
        'Eloquent' => IlluminateDatabaseEloquentModel::class,
        'Event' => IlluminateSupportFacadesEvent::class,
        'File' => IlluminateSupportFacadesFile::class,
        'Gate' => IlluminateSupportFacadesGate::class,
        'Hash' => IlluminateSupportFacadesHash::class,
        'Http' => IlluminateSupportFacadesHttp::class,
        'Lang' => IlluminateSupportFacadesLang::class,
        'Log' => IlluminateSupportFacadesLog::class,
        'Mail' => IlluminateSupportFacadesMail::class,
        'Password' => IlluminateSupportFacadesPassword::class,
        'Queue' => IlluminateSupportFacadesQueue::class,
        'Redirect' => IlluminateSupportFacadesRedirect::class,
        'Redis' => IlluminateSupportFacadesRedis::class,
        'Request' => IlluminateSupportFacadesRequest::class,
        'Response' => IlluminateSupportFacadesResponse::class,
        'Route' => IlluminateSupportFacadesRoute::class,
        'Schema' => IlluminateSupportFacadesSchema::class,
        'Session' => IlluminateSupportFacadesSession::class,
        'Storage' => IlluminateSupportFacadesStorage::class,
        'URL' => IlluminateSupportFacadesURL::class,
        'Validator' => IlluminateSupportFacadesValidator::class,
        'View' => IlluminateSupportFacadesView::class,
        'SEO' => ArtesaosSEOToolsFacadesSEOTools::class,
        'Bugsnag' => BugsnagBugsnagLaravelFacadesBugsnag::class,
        'Agent' => JenssegersAgentFacadesAgent::class,
        'Socialite' => LaravelSocialiteFacadesSocialite::class,
        'Image' => InterventionImageFacadesImage::class,
        'Purifier' => MewsPurifierFacadesPurifier::class,
        'ImageOptimizer' => SpatieLaravelImageOptimizerFacadesImageOptimizer::class,
        'HTMLMin' => HTMLMinHTMLMinFacadesHTMLMin::class,
        'Tracker' => PragmaRXTrackerVendorLaravelFacade::class,
    ],

];

I am using

  • Laravel 8
  • PHP 7.4.16 (cli)
  • Ubuntu 16.04.1

The application works well in local environment and worked before the composer update from ssh.

.env file also exists and details are set.

I have done these steps but none of them helped solving the issue:

  1. changing permissions of folders from ssh going te way of this answer:
    https://stackoverflow.com/a/37266353/4985607
  2. running these command :
    php artisan view:clear
    php artisan cache:clear
    php artisan config:clear
    php artisan config:cache
    composer uodate
    composer dump-autoload
    php artisan optimize
  1. deleting vendor folder and run composer install
  2. deleting bootstrap/cache inside files and rerun composer update

can any one help me solving this problem please?

2

Answers


  1. I faced this issue and found issue in config folder > constants file
    I was wrote "asset(‘/’)" function in config file, we can’t write such functions in config.

    Hope this answer will some one who stuck like this errors.

    Login or Signup to reply.
  2. I’ve got the same error, I found that I mistakenly changed APP_LOG from errorlog to debug
    APP_LOG=errorlog
    To
    APP_LOG=debug
    (I was trying to do something not related to this issue)

    Once I changed it back to errorlog, and ran php artisan config:cache, it worked again.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search