View Full Version : [ubuntu] CGI::Carp can't open log file permission denied

May 6th, 2009, 11:18 PM

I am running the Ubuntu LAMP server (uname -a -->
2.6.20-15-server i686 GNU/Linux) and am in the process of learning to use CGI scripts. All was going well until I tried to use the following .cgi script to test out CGI::Carp logging to an error log file:

use CGI::Carp qw(carpout);
open LOG, '>>', '/var/log/apache2/carperror.log' or die "Cannot open file: $!\n";
use CGI qw/:standard/;
print "Content-type: text/html\n\n";
print "hi";

the "$dbi->connect();" line is there to create an error but I get no output to the carperror.log file. carperror.log has the same permissions and ownership as the other error logfiles in /var/log/apache2. The following is the output in the apache error.log file:

[Wed May 06 14:39:33 2009] [error] [client] Cannot open file: Permission denied
[Wed May 06 14:39:33 2009] [error] [client] BEGIN failed--compilation aborted at /var/www/CgiBin/PerlCgiBook/Chap01/Listing1_15.cgi line 6.
[Wed May 06 14:39:33 2009] [error] [client] Premature end of script headers: Listing1_15.cgi

I would appreciate any help I can get and thank you all in advance,