Is there a php.ini directive that enables stack traces on errors?

后端 未结 2 1440
庸人自扰
庸人自扰 2020-12-21 04:12

Is there a php.ini directive that enables stack traces on errors? I already looked here: http://php.net/manual/en/ini.core.php. My shared-hosting does not have Xdebug inst

2条回答
  •  春和景丽
    2020-12-21 04:26

    There's debug_backtrace. This won't work for fatal errors though, since those cannot be handled.

    Example:

    gives:

    array
      0 => 
        array
          'file' => string '/tmp/cpu7HL5A' (length=13)
          'line' => int 9
          'function' => string 'exceptions_error_handler' (length=24)
          'args' => 
            array
              0 => &int 8
              1 => &string 'Undefined variable: a' (length=21)
              2 => &string '/tmp/cpu7HL5A' (length=13)
              3 => &int 9
              4 => &
                array
                  empty
      1 => 
        array
          'file' => string '/tmp/cpu7HL5A' (length=13)
          'line' => int 12
          'function' => string 'c' (length=1)
          'args' => 
            array
              empty
    

提交回复
热议问题