|
|
|
|
![]() ![]() |
May 19 2006, 05:51 PM
Post
#1
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 17-May 06 Member No.: 23,815 |
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:
CODE 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 X Warning: fwrite(): supplied argument is not a valid stream resource in /path/file.txt on line X Warning: 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/ |
|
|
|
May 19 2006, 11:48 PM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,910 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
try to alter the file's permissions to world write, ie: 777 using the chmod command.
|
|
|
|
May 20 2006, 12:17 PM
Post
#3
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 17-May 06 Member No.: 23,815 |
returns the error
Warning: chmod(): Operation not permitted in /path/file.php on line X as 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 This post has been edited by elrohir: May 20 2006, 12:26 PM |
|
|
|
May 20 2006, 02:50 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 630 Joined: 12-August 05 From: Melbourne, Australia Member No.: 10,624 |
I assmue you have declared the $file variable somewhere? e.g. $file = file.php Without this it will not work.
This post has been edited by Avalon: May 20 2006, 02:51 PM |
|
|
|
May 20 2006, 02:54 PM
Post
#5
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 17-May 06 Member No.: 23,815 |
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 |
|
|
|
Jun 13 2006, 01:12 AM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 397 Joined: 9-June 06 From: Wisconsin Member No.: 24,924 |
QUOTE Warning: fopen(file.php): failed to open stream: Permission denied in /path/file.txt on line X Warning: fwrite(): supplied argument is not a valid stream resource in /path/file.txt on line X Warning: 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. |
|
|
|
Jun 13 2006, 02:31 PM
Post
#7
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 17-May 06 Member No.: 23,815 |
Yeh, I asked them about it, and aftera couple attempts they fixed it
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 7th August 2008 - 11:36 PM |