Jump to content

[SOLVED] Can I Pause of stop a php script at an error message?


ahvceo

Recommended Posts

Hi Again All,

 

When I run my php script, a screen flashes with error messages on it but then in covered be the http screen.  Is there any way I can make the server "pause" or "stop" so I can see these error messages?

 

Thanks

ahvceo

Link to comment
Share on other sites

 

By setting a php error handler, you can do this. It is possible to log the errors or you can stop the execution.

 

Please have a look on the php function:

 

set_error_handler("customErrorHandler");

function customErrorHandler($error_level, $error_message, $error_file, $error_line, $error_context)
{ 
		exit("$error_message");

// You can also, log the error to a php file and can be view from there also.
                       

}


 

 

Link to comment
Share on other sites

Thanks Starphp for the information.  I am from the old school and started programming in 1962 so I like to see errors output to a file.  How do I log the errors other than fopen, fwrite and fclose?

 

Thabks again

ahvceo

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.