Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Closed Points: 125 Time: 06:13 - Nov 02, 2006
dustPuppy
How do I handle "difficult" errors in PHP? I have a call to the method "imagecreatefromjpeg" which seems to break the script, but I don't get any error message. I have enabled the ERROR_REPORTING(E_ALL); on the page. I think it's because it's running into a full memory problem, but how do I know, and how do I handle it? Basically what I'm doing is running through all the jpg images in a directory, creating thumbnails for them. And it works fine until a certain point and then just a blank page is output and nothing more.
Categories:
Add Categories
When adding more than one category, separate them with commas.
Date:: Nov 03, 2006
Time:: 02:32
I forgot to mention that I'm using PHP Version 5.1.6 on a Windows NT NS13 5.2 build 3790 machine.
Time:: 08:26
Well, finally it was a problem of several coinciding elements. My host doesn't allow errorreporting directly on the page, so that was why I wasn't getting the error. And the error was a script exceeded timeout problem, which could be solved by setting set_time_limit($seconds);
Time:: 08:27
I'm wondering though, how to handle fatal errors in php. Isn't there a nice way to take care of those, instead of everything breaking down? I mean at least capturing the error and showing a custom error message instead?
xarcus
Date:: Nov 16, 2006
Time:: 10:34
The best way to handle errors is try not to make them. So it would be good to add to each module a test set to discard it when problems arise. Then there is the environment. Set a phpinfo page to check your config. parameters in the target web zone. There are three handlers you can set, from which you can log anything you want to a file in your site with the function error_log. With register_shutdown_function( “myOnShutdown”) you may set a function that executes at the end of request processing. With set_error_handler( “myOnError”) you may handle the errors yourself. With PHP5 set_exception_handler(“myOnException”) you may set an exception handler for uncaught exceptions. There are also some network debuggers, explained at http://es2.php.net/manual/en/debugger.ph..., but you need access to certains sockets so it is not available when app. is hosted.
Time:: 10:58
From the manual (http://es2.php.net/manual/en/function.se...) >> The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called. >> If errors occur before the script is executed (e.g. on file uploads) the custom error handler cannot be called since it is not registered at that time.
Time:: 11:09
E_ALL does not include all errors (E_STRICT type is excluded). You should write error_reporting(E_ALL | E_STRICT) for all errors. ( see note at http://es2.php.net/manual/en/function.er...).
Time:: 12:08
that's great info there, xarcus. I think set_exception_handler(“myOnException”) is what I was looking for. Thanks a lot.
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software