0

I have found a PHP system that have a interesting feature.

If there is a error on the code, the default error message is not showed, the programmer have created a way to filter those messages and create a log to show those error messages as simple alerts on the administrator view.

How do I do that?

Thanks in advance

MORE DETAILS

Server: Apache

The system is from a company in Brazil and do not have access to it, it was just presented to me

1
  • Can you describe what the "PHP system" is? Also, what web server is running the front end (Apache?) and what server are you running? Commented Aug 17, 2011 at 22:33

2 Answers 2

1

PHP allows you to configure error reporting via the following directives in the php.ini file:

display_errors - "...determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user."

error_reporting - "Set the error reporting level."

log_errors - "Tells whether script error messages should be logged to the server's error log" or a custom log file.

Note: If you change the php.ini file, you need to restart Apache for the changes to become effective.

You can also use set_error_handler to create a custom error-handling function.

Sign up to request clarification or add additional context in comments.

Comments

0

Use set_error_handler

http://php.net/manual/en/function.set-error-handler.php

2 Comments

will that avoid the error on the user screen? thanks for the link
If you set your own error handler, PHP expects you to handle the error yourself, including displaying the error if you want to. If you don't do that, it won't be displayed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.