Skip to main content

Show errors in php

  • ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    
    Ini_set method sets the value of the given configuration option. Using this method you can show errors in php file. The ini_set function tries to override the configuration found in your PHP ini file. You can change some settings mentioned in php.ini using ini_set() functions like display_errors and display_startup_errors. The display_errors directive will determine if the errors will be displayed or hidden to the user. Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed so we use display_startup_errors to show those errors in php. Use this code at the top of your php script.
  • Back to code snippet queries related php