'Getting old cache view when there is PHP errors in controller - Laravel 5.6

I have a strange problem. I am using Laravel 5.6, When there is a PHP error or Laravel error (E_NOTICE, E_WARNING etc) in my controller then instead of throwing error, I am seeing the old cached view. And if I change the view data, it still show me the old cached view, but if I fix the error code then my view is getting updated.

So basically as long as there is any PHP error in my logic I am seeing old cached view instead of exception error(which is desirable) but if there is no error, my view is getting updated.

I have set APP_DEBUG=true and APP_ENV=local in my .env file. My folders have right permission. No opcache or PHP-FPM is enabled. I have run all below commands

  • php artisan view:clear
  • php artisan cache:clear
  • composer install
  • composer dump-autoload

Nothing seems to be working. I have also cleared my browser cache and I have manually deleted cache files from storage folder, but no luck

Server Configuartion

  • PHP 7.2
  • Apache 2.4
  • MySQL 5.7
  • CentOS 7.5

Edit:

One thing I noticed, If I leave the application untouched for few minutes, and then refresh the page, I can see the errors, that mean PHP is caching the page for some duration



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source