Can't open writable file in append mode - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Programming > Perl » Can't open writable file in append mode


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-13-2006   #1 (permalink)
jasmine
Junior Member
 
Join Date: Jul 2006
Age: 48
Posts: 10
Default Can't open writable file in append mode

This is a problem from a cgi script but I can't see how it can be an apache/cgi problem. I have a cgi script that tries to open a file int eh cgi-bin folder for writing. the -W and -w tests show that the script can write to the file. However when I try to open the file using open(THEFILE ">>/var/www/cgi-bin/file.txt" I get a failure with permission denied in the $! variable. It have tried every possible permissions setting on the file itself and the folder it lives in. Is there some situation wehre the -w and -W tests fail to work?
Thanks
Jasmine
jasmine is offline   Reply With Quote


Old 07-23-2006   #2 (permalink)
Ankita
Member
 
Join Date: Jul 2006
Age: 25
Posts: 53
Default Re: Can't open writable file in append mode

Hey can you write here the exact code that you are trying to use?
This syntax:
# Set $data_file to the location and name of the file in question.
my $data_file = '/var/www/cgi-bin/file.txt';

open DATA, ">>$data_file" or die "can't open $data_file $!";

should work for the file(should have write permission ofcourse!). One more thing try puting file.txt into some folder say mydata and then test that. Use Flock, this allows the script to block access to the file while it is opened. So that two users dont alter it at the same time.
Ankita is offline   Reply With Quote

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep your eyes open kconnections Marketing 6 08-02-2006 08:52 PM
ExpandReview [OPEN!] Default. Marketing 3 01-22-2006 07:41 PM
Psd File's Litepanel Graphics & Multimedia 4 08-13-2005 09:54 PM


footer left
All times are GMT. The time now is 03:25 AM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

Xecuter 3 Mod Chip | Cheap Electricity | Musica Reggaeton | Pay Day Loans | Debt Help

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49