LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Perl won't write to or create external files. (https://www.linuxquestions.org/questions/programming-9/perl-wont-write-to-or-create-external-files-255335/)

Decipher 11-15-2004 08:20 PM

Perl won't write to or create external files.
 
G'day,

Just wondering if anyone has experienced this problem, and if so, they know how to resolve said problem.

I'm currently writing a program, which one part of it needs to write data to an external data file. Generally that would be no problem, I've done it thousands of times. The code I'm using is such:

open(EML,">data/test.eml");
print EML "whatever...";
close(EML);

Whether or not the test.eml file exists makes no difference, and the permissions are all correct, I've even tried overkilling the permissions with:
chown nobody.nobody data
chmod 777 data

However, this makes no difference, the server just plain refuses to allow this to happen. This is all running on a Fedora Core 3 version of Linux, which shouldn't make a difference. But if I do the exact same thing on my Red Hat 9 Box it works perfectly.

I can read external files on the FC3 Box, just not write them. I have thrown this into a perl script to check the write access:

if (-w "data/test.eml") {
print "file writeable";
}

With a file in place of course.
I've been through the /etc/httpd/conf/httpd.conf file on both systems, and checked the configuration for CGI related options, and they where already identical.

Does anyone know of a reason this may be happening?

Cedrik 11-16-2004 06:47 AM

What are the permissions of the directory where resides your data file ?

Decipher 11-17-2004 01:38 AM

I've tried both 755 and 777 for the data directory.

It shouldn't really be an issue with the permissions as it works perfectly under Redhat 9 running the same permissions as I used on Fedora Core 2 (test 3), which doesn't work. It's extremely annoying as I much prefer Fedora Core 2 (test 3) over Red Hat 9, and was plannin to wipe the Red Hat Box and turn it into another OS.

Cedrik 11-17-2004 06:49 AM

Have you checked the user directive in httpd.conf, is it nobody ?


All times are GMT -5. The time now is 08:52 PM.