Laravel 5 - env local debug true no errors shown

Laravel 5 - env local debug true no errors shown

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Why Debug Mode Isn't Showing Errors in Laravel 5

You've set your .env file to APP_ENV=local, confirmed with php artisan env that the application environment is indeed local, and you've set APP_DEBUG=true in both the .env file and the config/app.php configuration. Despite this, when an exception occurs, you're greeted with a blank page rather than the detailed stack trace you expect. This behavior is a common point of confusion, specifically for those running older versions of Laravel like 5.x, because the root cause isn't a misconfiguration but a deliberate architectural decision regarding how the framework handles errors in production-like environments.

The issue stems from how Laravel initializes its error handling logic. In modern versions of the framework, there is a specific check that occurs early in the request lifecycle: is_production. This flag determines whether to display the full exception details or redirect to an error page. Even if you have explicitly set APP_DEBUG=true, if the application environment (APP_ENV) is not detected as local or development, Laravel will assume it is running in a production mode and suppress the detailed output.

In Laravel 5, the default behavior often assumes that if you haven't explicitly defined an environment, or if the environment detection logic doesn't match your expectations, it defaults to hiding errors. The most common culprit for this specific symptom—a blank white page—is that APP_DEBUG is being ignored because the framework has determined it should be safe to hide errors. This usually happens when the .env file isn't loaded correctly or if the environment variable is set inconsistently.

To resolve this, you must ensure that the APP_ENV is explicitly set to local in your .env file and that no other environment variables are overriding it. You should also verify that your web server (Apache or Nginx) isn't interfering with the request by stripping out headers or cookies that might confuse the framework's environment detection, though this is less common than simple configuration mismatches.

Here is a practical checklist to ensure APP_DEBUG functions as intended:

  1. Verify .env Integrity: Ensure your .env file contains exactly:

    APP_ENV=local
    APP_DEBUG=true
    

    Do not rely solely on the config/app.php file for this setting, as it is meant to be an override and should only differ from the environment variables if necessary.

  2. Restart the Application: After modifying the .env file, especially in Laravel 5 where caching can be aggressive, you may need to clear configuration caches:

    php artisan config:clear
    php artisan cache:clear
    
  3. Check for Production Overrides: If you have a deployment script or a Docker environment that sets APP_ENV=production, ensure that this isn't persisting across your local development sessions. The is_production check in the framework will override your debug setting if it detects a production environment.

It is also worth noting that in Laravel 5, the default error handler might be configured to log errors only if APP_DEBUG=false. If you want to see errors without displaying them, you can set APP_DEBUG=true and ensure APP_LOG_LEVEL is set appropriately, but for local development, you almost always want both flags aligned.

If you are migrating from an older setup or dealing with a complex hosting environment where the .env file is not being read by default, consider explicitly setting the debug flag in the config/app.php file as a fallback:

return [
    'debug' => env('APP_DEBUG', true),
];

This ensures that even if the environment variable is missing or misconfigured, Laravel defaults to showing errors.

Understanding how Laravel's environment detection works prevents frustration when debugging critical issues. By aligning APP_ENV and APP_DEBUG, you ensure that the framework behaves predictably during development. For more advanced debugging techniques in Laravel 5 and beyond, including log analysis and event logging, resources like https://laravelcompany.com offer insights into best practices for maintaining a healthy development workflow.

Our network