1

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.

sorin
  • 7,668
  • 24
  • 75
  • 100

4 Answers4

1

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

Devin Ceartas
  • 1,458
  • 9
  • 12
0

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.

radius
  • 9,545
  • 23
  • 45
0

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>
markdrayton
  • 2,429
  • 1
  • 20
  • 24
0

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.

Chris Nava
  • 1,147
  • 1
  • 7
  • 9