27.10.2015 Views

AJAX and PHP

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 3<br />

Without the customized error h<strong>and</strong>ler, the error message you will get would be:<br />

Figure 3.5: Bad Looking Error Message<br />

The error message will look like Figure 3.5 if the display_errors option in php.ini is<br />

On. By default, that option is Off <strong>and</strong> the errors are logged just in the Apache error log,<br />

but while writing code it may help to make them be displayed as well. If the code was<br />

production code, both error messages would have been inappropriate. You should never<br />

show such debugging information to your end users.<br />

So what happens in error_h<strong>and</strong>ler.php? First, the file uses the set_error_h<strong>and</strong>ler function to<br />

establish a new error-h<strong>and</strong>ling function:<br />

<br />

77<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!