fopen() problems - cannot write to a file?

Troubleshooting with your custom scripts/programs installed on Polarhome.

Moderator: Moderators

fopen() problems - cannot write to a file?

Postby Nazca » Mon Apr 25, 2005 4:53 am

I think I may have had this problem before and it was my own stupidity that was the trouble -- but as of now my PHP scripts are refusing to write to files (that already exist).

As such:

$fileopen = fopen("mylog.txt", "a");

fwrite($fileopen, "$addition");
fwrite($fileopen, "\t @ $IP \n");

fclose($fileopen);

I've also tried using the full path to mylog.txt, which gave a more specific error message - failed to open stream: HTTP wrapper does not support writeable connections.

Is this my fault, or has something changed?

EDIT: I've also tried using "w" and "wa" instead of "a" for the type of stream I'm opening...no luck.
Nazca
Newbie
 
Posts: 7
Joined: Thu Dec 30, 2004 5:10 am

Postby miker_alpha » Mon Apr 25, 2005 9:09 am

try using "rb+"
works for me (on OpenVMS Alpha)

YMMV

MikeR
Look for OpenVMS help on my webpage
Check for QOTD here.
Image
User avatar
miker_alpha
Moderator
Moderator
 
Posts: 256
Joined: Sat May 08, 2004 9:20 am
Location: Kibbutz Tzora, Israel

Postby Nazca » Mon Apr 25, 2005 11:12 pm

Sadly, no. :( I tried further combinations of "wa+", "rb", "rb+", etc.

I also changed file permissions, but that didn't help. Having the PHP script create the file itself didn't work, access was denied.


EDIT: By the way-- My account is on IRIX, if this matters.

EDIT2: Ok, tried putting my PHP up on another server I have access to and after a little tweaking, got it to work. Maybe it's the server, or maybe I just need to update it on IRIX. Consider the problem fixed. :)
Nazca
Newbie
 
Posts: 7
Joined: Thu Dec 30, 2004 5:10 am


Return to Troubleshooting

Who is online

Users browsing this forum: Google [Bot] and 21 guests

cron