Search code examples
phperror-reporting

Error reporting is set to 0 but it is still showing errors


In my application I have error_reporting set to 0 and just to make sure i is set when I echo error_reporting() it says it's 0.

If I leave out a semicolon on purpose just to trigger an error (somewhere under where I have it set to 0) it still displays the error:

Parse error: syntax error, unexpected T_VARIABLE in . . .

Does anyone know why this is happening? I am developing on my own machine using WAMP.

Thanks.


Solution

  • Since it's a parse error, it is encountered before it actually runs any of your code, and so it shows up.

    You should change the setting in the php.ini file instead, as this will be handled before parsing the PHP file.