I was not able to open a file from any other directory. I don't see any access problem in the httpd logs (access_log), put the open() function returns "Permission denied" error. I have kept the 755 permission for the file.
the file is in /dep/abc/def/<varing-name>/*.log
I have created <Directory "/dep/abc/def/">
options all
Allowoveride None
Order allow,deny
allow all
</directory> in httpd.conf file..
I'm not sure this problem comes because httpd.conf configuration issues or permission problem in Perl
If it is httpd.conf issue then access_log file should show that error... that is not happening..
If Perl permission issue then it should open the file even if it is /var/www/cgi-bin directory
Please help me, I want to open a text file from /dep/abc/def/<variying-directory>/<variyingfilename>.log
The variying based on the user selection.
it's not about permissions on your cgi-script.
<Directory "/dep/abc/def/">
Options All
AllowOverride None
Options ExecCGI FollowSymLinks Indexes
Order allow,deny
Allow from all
</Directory>
and my files are in /dep/abc/def/#*$! directory
in which my /dep/abc/def is the base directory and the #*$!/filename will be varying depend on the user selecting it
I have function as
sub get_log_content {
my $fullFilename = shift;
my @contents;
my $error=0;
open(FILE, $fullFilename) ¦¦ ($error = 1);
if ($error) {
push @contents, "$fullFilename File Open Error: $!";
return @contents;
}
while (<FILE>) {
push @contents, $_;
}
close(FILE);
return @contents;
}
When I call these function it returns
/dep/abc/def/#*$!/yyy.log File Open Error: Permission denied
all the path have permission 755, own is root and group is root
and apache is running as nobody and nobody
I was able to open a file only in / & /var/www/cgi-bin & /var/www/html locations and not able to access anywhere else
Please help me out
[edited by: phranque at 1:56 pm (utc) on Feb. 7, 2009]
[edit reason] disabled graphic smileys ;) [/edit]