Forum Moderators: coopster

Message Too Old, No Replies

fwrite and fclose

not valid stream?

         

brancook

7:33 pm on Mar 10, 2007 (gmt 0)

10+ Year Member



I'm getting an error in my php but the funny thing is it works on one server but doesn't work on another. When I submit the text I have on a form I get the following error:

fwrite(): supplied argument is not a valid stream resource
and
fclose(): supplied argument is not a valid stream resource

I'm just trying to write to a flat file on the server, i'm a php newbie.

dreamcatcher

7:43 pm on Mar 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi brancook,

The error reporting level may be different on the one server. What file are you trying to write to? Does it exist? Are there write permissions on the file or directory you are writing to?

dc

brancook

3:57 pm on Mar 11, 2007 (gmt 0)

10+ Year Member



Hi dreamcatcher,

I'm writing to a text file that I have on the server, it is already created. There are no premissions that I have set up. Is it possible that the hosting company has different permissions?

jatar_k

4:49 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



every file is owned by the user that created it and that file is given default permissions

the user that php runs as is not necessarily the same user you were acting as when you created the file

if the owner is different then the permissions of the file need to be changed for another user to change that file

you can test your file pointer after you try to open the file to see if it was successfully opened, if it was not then try changing the permissions on the file and running the script again.