473,395 Members | 1,941 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,395 software developers and data experts.

Help for Error handing and logging in PHP

hi, all
We are running a php program for business. We want to hand the
error in the following way: Don't display the error messages but give
some other information such as our service telephone number and some
others. It is useful for our customers to get quick help when problems
happen.
How can i do that? Thanks for your suggestion!
Jul 17 '05 #1
3 1538
On Fri, 14 May 2004 00:10:38 +0800, Lian Liming wrote:
hi, all
We are running a php program for business. We want to hand the
error in the following way: Don't display the error messages but give
some other information such as our service telephone number and some
others. It is useful for our customers to get quick help when problems
happen.
How can i do that? Thanks for your suggestion!


I'm going to assume that you are running Apache. If you aren't, you will
have to specify which server you are using.

It can definately be done. A good place to start is
http://www.onlamp.com/pub/a/onlamp/2...avidsklar.html

- -
Mark J. Nenadov
Python Byte Solutions (http://www.pythonbyte.com/)

Jul 17 '05 #2
Lian Liming wrote:
We are running a php program for business. We want to hand the
error in the following way: Don't display the error messages but give
some other information such as our service telephone number and some
others. It is useful for our customers to get quick help when problems
happen.
How can i do that? Thanks for your suggestion!


Check out the PHP manual for error handling and logging
http://www.php.net/manual/en/ref.errorfunc.php

But it is better to not have errors in your scripts :)
Everytime a function can fail, test for failure and call an appropriate
function to deal with it
<?php // assume ALL_CAPS are define()'d constants
/* ... */
mysql_connect(DB_HOST, DB_USER, DB_PASS) or handle_error(ERR_CONN);
/* ... */
if ($x == 0) handle_error(ERR_DIV0);
/* ... */
?>

where the handle_error() function does whatever you want, including
sending HTML to the client with your service telephone number and other
data you might need.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #3
Take a look at http://www.tonymarston.co.uk/php-mys...orhandler.html
which gives you an example on how to customise the PHP error handler.

You can change this so that any piece of text is shown on the client's
browser while a proper description of the error is written to a logfile
and/or emailed to the system administrator.

Easy peasy lemon squeezy.

--
Tony Marston

http://www.tonymarston.net

"Lian Liming" <ha**@123.com> wrote in message
news:2g************@uni-berlin.de...
hi, all
We are running a php program for business. We want to hand the
error in the following way: Don't display the error messages but give
some other information such as our service telephone number and some
others. It is useful for our customers to get quick help when problems
happen.
How can i do that? Thanks for your suggestion!

Jul 17 '05 #4

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

Similar topics

5
by: Jerry | last post by:
Hi All I would very much appreciate your help: I have two scripts alternating in the background triggering themselves mutually. Here is how: 1.) Script A does something and then calls Script...
2
by: rh0dium | last post by:
Hi all, So I have a slice of code which calls other python code. I have started to take a real liking to the logging module, but I want to extend this into the called python code. I have no...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
9
by: Arvind R | last post by:
Hi, I need to log all info,of whoever logs into my application and what all he clicks...and which all methods are executed and what parameters are passed. Is there any way I can log info at a...
0
by: R Reyes | last post by:
ISSUE (reposted) =========================== Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? For many people, they say they add the...
7
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
0
by: Roopesh | last post by:
Hi I am trying to use RotatingFileHandler, in the foll way : rootLogger = logging.getLogger('') rootLogger.setLevel(logging.DEBUG) rotatingHandler =...
10
by: arvindkuk | last post by:
how to work with expection handing in which when i am using try block then the error message coming that "undefined symbol try" why it is so, please solve my problem.
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.