error reporting

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
What is the proper way to turn off error reporting? I'm on a shared  
server so...

"Note:  Although display_errors may be set at runtime (with ini_set ()),  
it won't have any affect if the script has fatal errors. This is because  
the desired runtime action does not get executed."

... has me confused if this will really work. Sorry I'm rusty on this.

"To set at runtime, use the error_reporting(). See also the  
display_errors directive."

I don't mind if visitors get some error messages when there is a problem  
but when the database goes down for a moment they get the login &  
password that failed <grin>.

Re: error reporting


My advice would be to ensure that your script has no errors, period.  Don't  
disable the error reporting because it's there for a reason ;)

Try and enumerate all possible scenarios that may cause a problem, and  
create a workaround/solution for them.  Less headaches in the long run, imo.


Re: error reporting

Paul Furman wrote:
Quoted text here. Click to load it

That depends on what you mean by turning off error reporting. Setting
display_errors to 0 means simply that PHP won't display error message.
Depending on the error reporting level, the error could still be
recorded in the error log (if one is set up). Doing a
error_reporting(0) means errors won't get into the error log either.

Another difference is that error_reporting(0) doesn't stop CORE
error/warning messages from displaying. They're very rare though.

Quoted text here. Click to load it

Yeah, the phraseology is kinda weird. What they mean is if you have a
syntax error in your script, then error_reporting(0) never gets called
as the operation has died (and emitted the error message) at the
parsing stage. They don't say that exactly because in PHP 5, some
language errors in some circumstances can cause early termination too.

Re: error reporting

Paul Furman wrote:

Quoted text here. Click to load it

OK so I just inserted this line:
ini_set (display_errors, 0)

However I still get mySQL syntax errors, the most obvious problem before  
was with database connection errors when the database server went down  
for maintenance so this concerns me. I'm not sure if that was SQL or PHP  
error messages. Can I turn off mySQL errors?

Re: error reporting

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Re: error reporting

R. Rajesh Jeba Anbiah wrote:

Quoted text here. Click to load it

Late reply, any SQL problem I think, recently there was a syntax error  
due to an unescaped quote, before the database server (separate machine)  
was down for a minute & it reported that problem although that might  
have been php, not mysql.

Site Timeline