The Production Environment
The production environment, from an error-reporting perspective, needs to be as tightly controlled as possible. You want to fully control what the end user sees and experiences. Things like SQL failures and code syntax warnings should never be seen by the client, if at all possible. Your code base, of course, should be well mitigated by this time—if you have been using the two aforementioned environments properly and religiously—but sometimes errors and bugs can still get through to production. If you’re going to fail in production, you want to fail as gracefully and as quietly as possible.
Note
Consider using 404 page redirects and try...catch
structures to redirect errors and
failures to a safe landing area in the production environment. See Chapter 2 for proper coding styles of the try...catch
syntax.
At the very least, all error reporting should be suppressed and sent to the logfiles in the production environment.
Get Programming PHP, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.