LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-15-2004, 08:20 PM   #1
Decipher
LQ Newbie
 
Registered: Nov 2004
Posts: 2

Rep: Reputation: 0
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?
 
Old 11-16-2004, 06:47 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
What are the permissions of the directory where resides your data file ?
 
Old 11-17-2004, 01:38 AM   #3
Decipher
LQ Newbie
 
Registered: Nov 2004
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
Old 11-17-2004, 06:49 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Have you checked the user directive in httpd.conf, is it nobody ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl write to file Xris718 Programming 7 06-03-2005 09:10 AM
cannot write on external HDD trutnev Red Hat 2 03-20-2004 03:02 PM
Linux, Create Dirs=no, Create files=yes. Possible? tisource Linux - General 4 01-12-2004 10:05 PM
how to write a script to create a directory mgam Linux - Newbie 1 10-29-2003 12:08 PM
Help installing forum, won't write or create files. Drogo Linux - General 2 10-12-2002 10:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration