472,779 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 1539
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. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.