When programming in C, I often get the advice to turn on many or all warnings and not ignore warnings.
Does the same hold in PHP, should I enable all warnings in the PHP log?
Default log level for PHP excludes notices, ie. it's
E_ALL & ~E_NOTICE for PHP 5.2,
E_ALL & ~E_NOTICE & ~E_STRICT for 5.3 and
E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED for 5.4.
If you're working only with your code, then you're much better off setting it to
E_ALL. Seeing notices will save you lot of debugging time, seeing deprecation and compatibility notices, will save you a lot of pain upgrading to newer PHP.
However, if you're working with third party code, turning on all notices (
E_DEPRECATED) can lead to spamming of your log, as a lot of older code will generate a notice every few lines of code.
Yes, of course. Why on Earth would you not want to automatically catch as many problems and potential issues as you can, especially when starting from scratch?
Enabling warnings in PHP gives an extra edge for a programer to know where his coding is going wrong on which page , line etc... imagine manually checking 1000's of line to catch an error, if you have included multiple files, then you need to check as many as you have got. Therefore, it is better practise to enable it for a programer point of view!.
In development phase of project I prefer to have: "E_ALL | E_STRICT" with display_errors turned on too so I can get all possible warning/erors/notices and so on. Just a simple lapsus in $user vs $usr can create a whole bunch of problems later and PHP without this setting will not create build problems but will generate broken bussiness logic.
In production mode it is best to have them turned on too but disabled display_errors flag. You can create your own custom error handler so logs can be written there or use for instance Apaches error log to find them (custom ones are better since you can write down more context that you need)