Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

4 Answers

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
add comment

Basically as radius says, catch & display the error rather than let it pass through. In perl, see the Carp module: http://search.cpan.org/~nwclark/perl-5.8.9/lib/Carp.pm

share|improve this answer
add comment

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
</Directoy>
share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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.