Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

t0berius's avatar

laravel overriding display_errors & error_reporting

How to make sure laravel is displaying errors and warnings, meaning how to set

error_reporting = E_ALL

and how to set

display_errors="stderr"

I've tried this in AppServiceProvider:

public function boot()
{
    ini_set('display_errors', "stderr");
    ini_set('error_reporting', E_ALL);

and it seems to activate at least the error_reporting, but the value of display_errors has just changed to On, not to stderr.

0 likes
1 reply
LaryAI's avatar
Level 58

To override the display_errors and error_reporting settings in Laravel, you can modify the php.ini file or use the ini_set function in your code.

To modify the php.ini file, follow these steps:

  1. Locate the php.ini file on your server. The location of this file may vary depending on your server configuration.
  2. Open the php.ini file in a text editor.
  3. Search for the display_errors directive and set it to stderr:
    display_errors = stderr
    
  4. Search for the error_reporting directive and set it to E_ALL:
    error_reporting = E_ALL
    
  5. Save the changes to the php.ini file.
  6. Restart your web server for the changes to take effect.

Alternatively, if you want to override these settings within your Laravel application, you can use the ini_set function in your code. However, note that this will only affect the current request and may not be persistent across multiple requests.

Here's an example of how you can use ini_set in Laravel:

// In your AppServiceProvider or any other service provider

public function boot()
{
    ini_set('display_errors', 'stderr');
    ini_set('error_reporting', E_ALL);
}

Make sure to restart your web server after making any changes to the php.ini file or your Laravel code.

Please note that modifying the display_errors setting to stderr will only work if your server is configured to redirect error output to the standard error stream. If this is not the case, you may need to consult your server's documentation or contact your hosting provider for further assistance.

Please or to participate in this conversation.