note 113891 added to function.error-reporting
| From: | polecat1 | Date: | Fri, 13 Dec 2013 16:02:00 +0000 |
| Subject: | note 113891 added to function.error-reporting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197927@lists.php.net to get a copy of this message | ||
Most of you know that a script can give different results online compared to your local machine (PHP
versions, settings). Nobody wants to see an error message on your online website, like "Access
denied for user 'YOURUSERNAME'@'localhost' (using password: YOURPASSWORD)".
But sometimes we do need this information on our online site for debugging. Here's a little
trick.
On your local machine for your own browser create a cookie, something like:
setcookie ("your-website.com-testing", "1", time()+60*60*24*300);
Then in all your pages (or in includes) add the following line:
if (!isset($_COOKIE["your-website.com-testing"])) {
error_reporting(0);
}
This way errors will be reported ONLY when the page is displayed in YOUR browser.
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.error-reporting.php
Edit -- https://master.php.net/note/edit/113891
Del: integrated -- https://master.php.net/note/delete/113891/integrated
Del: useless -- https://master.php.net/note/delete/113891/useless
Del: bad code -- https://master.php.net/note/delete/113891/bad+code
Del: spam -- https://master.php.net/note/delete/113891/spam
Del: non-english -- https://master.php.net/note/delete/113891/non-english
Del: in docs -- https://master.php.net/note/delete/113891/in+docs
Del: other reasons-- https://master.php.net/note/delete/113891
Reject -- https://master.php.net/note/reject/113891
Search -- https://master.php.net/manage/user-notes.php