Over the last several days, I have discovered that PHP, much like Perl, is very forgiving of bad syntax if you want it to be, but can be downright pedantic if you ask it to.
In php.ini, you’ll see a configuration variable called ‘error_reporting’. On your production server, you generally want this set to E_WARNING or perhaps even E_ERROR
, so that you only see the critical stuff. However, if you set it to E_ALL
on your development server, and tail -f
your error log while you’re working, you’ll see all sorts of extremely helpful warning messages that tell you when you’re making small syntax blunders.
Ordinarily, stuff that is displayed is unimportant, in the sense that if you don’t fix it, things will keep working. However, if you attempt to eliminate all the warnings, you’ll end up with better, more maintainable code, and, more importantly, you’ll find small problems long before they have a chance to become large problems.
Setting error_reporting
to E_ALL
on your production server, on the other hand, is a good way to generate multi-gigabyte logfiles in a very short time.
Caveat: I have no idea if this applies to PHP 4. If you’re using PHP 4, you really should upgrade to PHP 5. It’s a vastly better language in so many ways that it’s really hard to make a fair comparison between the two.