[QUOTE=hessodreamy;4996106]Even if you turn off display_errors for production (which, of course, you really really should do), you can still set the error_reporting level to log (but not display) whatever errors you choose. Even in production the error log is useful for debugging errors, and the less that’s in there down to lazy coding (uninitialised variables etc) the easier it is to track down the actual problem.[/QUOTE]
As I said in a previous message, for development I have: error_reporting(E_ALL | E_STRICT)
When I looked at php.net, I found: Log_errors boolean
This just seems to set this to false. So if I leave the boolean out of the setting, does that mean all errors get logged? Since the live site is hosted, is there a way to define where the log is stored (with several on the same server, it would be nice to separate them)? Can I change the amount or type of errors that are logged?
There are basically four ini settings involved in error logging (well, probably more, but these three control the basic setup).
error_reporting - what do you want to report, i.e., which error levels do you want to report
display_errors - do you want to show the errors on the screen, i.e., in the browser. Useful for development, bad idea for production.
log_errors - do you want to log errors to a file (On or Off).
error_log - of log_errors is set to On, where do you want to log the errors (in a file, in the syslog, etc). If log_errors is set to ‘Off’ this setting doesn’t do anything.
These settings don’t influence one another. So if I set display_errors to On, this does not change my value of error_reporting. Similarly, if I change the value of log_errors, this also does not change the value of error_reporting.
At this moment these are exactly the same. However, this may change in the future.
-1 is “All errors, always”, and E_ALL | E_STRICT will currently also show all errors (since those two encompass all error levels there currently are).
The difference is that -1 also includes error levels that are not currently there yet. So suppose (and this is just an example) that php decided they wanted an extra level like E_SUPER_STRICT and not include this in E_ALL, you’d have the change E_ALL | E_STRICT to E_ALL | E_STRICT | E_SUPER_STRICT.
With -1 you don’t have to change anything, because it already includes everything, always.
In the .ini you use on/off. With [fphp]ini_set[/fphp] you’d use use 0/1, or true/false. This goes for all php ini Boolean directives AFAIK.
You’d give the complete path: /path/to/my/logfile.log, or a string like ‘syslog’ which will log the systems logger (/var/log/syslog on *nix, the event logger in windows)
It’s actually a boolean with an extra value. The value is either “On”, “Off” or “stderr”. That last value is only of help when running PHP on the command line, and doesn’t do anything when running from a webserver.
If you a local setup like MAMP or WAMP or something, just toy around a bit with these values to get a feel for them. Theory only gets you so far
Thanks for the great help. I now have enough knowledge/understanding to really start making a mess.
I know that when I get in a real mess, I can get pointed in the right direction here.
For a little bit more understanding for those that are following along, The error reporting is a Bitwise AND comparison.
So… simplify it a bit.
1 = warn
2 = error
4 = fatal
8 = supererror (something i made up)
So, E_WARN would be defined as 0001 (intval 1). We could define E_SERIOUS as 0110 (6). E_ALL as 1111 (15).
Why -1? Because integers are signed, and (lets say) 8 bits long (1 byte, for simplicity’s sake. I know int numbers are usually much longer.)
So our numbers are actually
0000 0001
0000 0110
0000 1111
If our script throws a Warning, it does an AND with our defined reporting level (lets say we did E_SERIOUS [0000 0110]), and it’s report level (warning = 0000 0001 = 1). 0000 0110 & 0000 0001 = 0000 0000 (if you dont get this part, google ‘bitwise and’). The result = 0, so we do not report the error.
We’ve got 3 unused bits (16,32, and 64. 128 is the sign bit, because it is the highest order bit in our number). So we could add a new value, 16 - ultraerror. Now our E_ALL doesnt catch that (0001 0000 AND 0000 1111 = 0000 0000).
-1, however, is represented as 1111 1111 - it truly would catch everything.