elrohir 0 Report post Posted May 19, 2006 I had a script that was working just fine untill yesterday, when something freaked out with an fopen() I used in a login process (to add the user to the active users list). I think my host must have upgraded version and has not changed the permissions in php.ini to allow normal users to access such simple functions. The code I am using is really as basic as you can get: if (!file_exists($file)){ $fh = fopen($file, 'w') or die("can't open file"); $write = $username.':'.$remote; fwrite($fh, $write); fclose($fh); } it returns:-Warning: fopen(file.php): failed to open stream: Permission denied in /path/file.txt on line XWarning: fwrite(): supplied argument is not a valid stream resource in /path/file.txt on line XWarning: fclose(): supplied argument is not a valid stream resource in /path/file.txt on line X-Any ideas how to get round this? I do not have all that much experience with other methods - only ever needed 'w' - but it worked before.Thanks in advance/elrohir/ Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted May 19, 2006 try to alter the file's permissions to world write, ie: 777 using the chmod command. Share this post Link to post Share on other sites
elrohir 0 Report post Posted May 20, 2006 (edited) returns the error Warning: chmod(): Operation not permitted in /path/file.php on line Xas well as the previous errors... I have contacted the support - hopes up high - as it I do not seem to have any permissions whatsoever, which really is freaking me out ... We will se... Edited May 20, 2006 by elrohir (see edit history) Share this post Link to post Share on other sites
Avalon 1 Report post Posted May 20, 2006 (edited) I assmue you have declared the $file variable somewhere? e.g. $file = file.php Without this it will not work. Edited May 20, 2006 by Avalon (see edit history) Share this post Link to post Share on other sites
elrohir 0 Report post Posted May 20, 2006 well, yeah... As I said, I did not change the source, and suddenly it started giving funky error messages... I think I would have figured out if I had not set $file... but thanks for checking Share this post Link to post Share on other sites
ghostrider 0 Report post Posted June 13, 2006 Warning: fopen(file.php): failed to open stream: Permission denied in /path/file.txt on line XWarning: fwrite(): supplied argument is not a valid stream resource in /path/file.txt on line XWarning: fclose(): supplied argument is not a valid stream resource in /path/file.txt on line X I think the best thing you can do is talk to your host about file permissions, I had to do that with my last host and he did it write a way. Once your file permissions are solved then all 3 errors should go away. Share this post Link to post Share on other sites
elrohir 0 Report post Posted June 13, 2006 Yeh, I asked them about it, and aftera couple attempts they fixed it Share this post Link to post Share on other sites