Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in getting errors from cgi-bin scripts inside the browser like the PHP errors.

The cgi script can be Perl, Python, Ruby, binary or something else. I'm not interested about a specific solution - I'm looking for something that should work with any script.

I want to use is on a development/test server not in production. I am aware that in production you should not display the error_log to the user.

I'm looking for a script to be used to replace ErrorDocument inside Apache. I had one in the past but I lost it.

share|improve this question

Basically as radius says, catch & display the error rather than let it pass through. In perl, see the Carp module:

share|improve this answer

I think that using a wrapper can do that. Write a script that always return 0 so that apache will never do error 500 for it. In this script launch the true script to execute and catch STDOUT and STDERR to be able to send them back to the client.

share|improve this answer

Not quite what you asked but how about just exposing the logs through an alias?

Alias /var/log/httpd /apache-logs
<Directory /var/log/httpd>
  # access control options, fancy indexing options, etc
share|improve this answer

In the past I've placed a small script on my development server that tailed the log file to the browser. It didn't replace the 500 error but I suppose you could have Apache redirect to such a script when a 500 error is detected.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.