473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

provide pretty page for fatal errors?

Hi,

Is it possible in PHP to provide a nice pretty page when a fatal error
occurs? (Or any of the errors listed here
http://uk.php.net/manual/en/function...or-handler.php which you
cannot catch).

I have error_reporting turned off as I have a production server - but
that just gives a blank page which is less than good.

Si

Oct 27 '06 #1
1 1569
Simon Kittle schreef:
Is it possible in PHP to provide a nice pretty page when a fatal error
occurs? (Or any of the errors listed here
http://uk.php.net/manual/en/function...or-handler.php which you
cannot catch).

I have error_reporting turned off as I have a production server - but
that just gives a blank page which is less than good.
With these kind of errors, the parsing comes to a dead stop, hence why
you cannot apply user-defined functions to handle them.

This implies that you cannot do anything on the server level to handle
these errors.

Client-side, however, you could use javascript to forward to a new page
or print a message. Example:

<?php

print <<<EOS
<script>
window.onload = function () {
if (!window.ok) {
document.location = 'error.html';
}
}
</script>
EOS;
foo();

print '<script>var ok = 1</script>';

?>

In this case, the call to the undefined foo() function causes a fatal
error, so var ok gets never set and the onload action redirects the user
to error.html

When foo() is defined, var ok will be printed and the onload function
will do nothing.

HTH;
JW
Oct 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Tim Tyler | last post by:
I'm getting fatal errors when executing code - and my error handler is failing to trap them - so I get no stack backtrace :-( The error I am getting is: "Fatal error: Call to a member function...
1
by: Mike | last post by:
Last weekend I decided to install Apache 2.0.53-win32-x86-no_ssl PHP 5.0.3 Smarty 2.6.7 MySQL essential-4.1.10-win32 I have Apache up (Port 80 blocked at the router and firewall!) and I have...
5
by: Rene | last post by:
Suddenly in one database we have a lot of errors, it seams some things are corrupted. I tried to start maintanance / database repair, but this fails too. When selecting in Query Analyzer a range...
3
by: Joel D. Kraft | last post by:
I've been logging a lot of fatal errors on my site lately, and I have not been able to figure out why. First, my site has error handling pages defined globally as shown below. They are not...
4
by: ARF | last post by:
I'm testing AutoCAD 2005 automation via VS2005 Pro C++/CLR and I'm getting fatal compiler errors. I start with a default C++/CLR class library project and modify it by adding the following...
6
by: comp.lang.php | last post by:
I am using session_start() on index.php and for some reason sometimes it'll fail. No warnings, no errors, no notices, not even after prepending error_reporting(E_ALL) and ini_set('display_errors',...
4
Computer Guru
by: Computer Guru | last post by:
Certain sites I visit with my browser give me fatal errors. They work with IE so why not an IE browser on a Win32 Application? I have tried ~ On Error Resume Next but it...
2
by: vijayrvs | last post by:
SearchCrawler.java The program search crawler used to search the files from the website. From the following program i got 7 compiler error. can any body clarify it and provide me solution. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.