FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Web Developer Seeks Files Willing to be Written To





PatTheGreat42
Alrighty; this is getting annoying.

A while back, I checked up on my site, and lo and behold, I very suddenly couldn't write to any files. In the part of the code that did, in the past, successfully write to files, I got this lovely error message:

Quote:
Warning: fopen(visitors.txt) [function.fopen]: failed to open stream: Permission denied in /home/patthegr/public_html/index.php on line 79

Warning: fwrite(): supplied argument is not a valid stream resource in /home/patthegr/public_html/index.php on line 80

Warning: fclose(): supplied argument is not a valid stream resource in /home/patthegr/public_html/index.php on line 81


(Or something along those lines.) Now, this is especially confusing to me because the code I'm using used to work. I didn't change anything, I didn't do anything, I didn't crazilly mess with file permissions.

So what did I do? I went on Frihost and asked for help. The suggestion was to use chmod to change the file permissions. One quick PHP file later and a shoter test, and I got the following error message:

Quote:
Warning: chmod() [function.chmod]: Operation not permitted in /home/patthegr/public_html/filefix.php on line 13


So, obviousely, changing file permissions didn't work. And thus, I am completely stumped. I have no idea what to do to fix this problem, and I suspect that it's higher-level stuff I can't access. I would really appreciate ANY help I can get on this.

I want my write permissions back... [sob]
Esch
You could try modifying the permissions for that file in an ftp client; I believe frihost supports that.

Otherwise, you may be up a creek here; they've probably disallowed chmod() .
jabapyth
the way to do it in PHP is chmod: info HERE

Alternatively, you could use cgi (Perl,Python,etc.), which works directly on your server, and doesnt need chmods.

The second way is more secure, because if you chmod a file to be publicly etitable, ANYONE can modify it. Not that this is likely to happen, but it could.
ock1991
does the inability to open text file occur to other scripts and their files? And yes, chmoding through a FTP Client or the panel that frihost uses should work.
riv_
But I'm having the same problem.
I started with the FTP client, and then tried the frihost admin panel.
Nice theory that it should work. But here I am Mad
riv_
Frihost is running in safe mode. That means they've restrcted our privileges to read and write to files (among other things) in an apparent effort (lesss than successful in my experience) to protect us from hackers.
Anyone know if there's a way around it?
For me, it just might mean it's time to pay for hosting.
Esch
I just ran into this problem recently; oddly, changing the permissions of the enclosing directory (the one in which my script + the stuff I wanted to write to) to 777 made it work. You should be able to change permissions with an FTP client (even IE will do it), should chmod() not work.
riv_
Aren't there security problems with setting permissions to 777?
(I've been trying with 755)
Esch
Well, yes...using 755 is a better option hands-down, but I guess I'm one of those kinds of people who fall under the camp of loosening security till whatever it is I'm trying to do works, then tightening it up later. Indeed, if you use 777, then any other user could browse your directory (including ones running under apache, I assume...though, I wonder if this is already possible, since by default Apache is configured to run under the same username for all virtual hosts -- hopefully Frihost isn't that naive.)

In short, you're right, and I stand corrected :3
simplyw00x
Any idea whether this was intentional? Changin all the permissions doesn't seem to be a great step at all... perhaps it was an accident?
Related topics
*OFFICIAL* Which Browser do you use?
(official) Firefox & Thunderbird 1.5 Beta2 Now Available
What are you studying or what's your profession?
Flash Site or No?!
Hello! Salut! Hallo! Hola!
Ruby on Rails -- great Web development framework
Who's using HTML Kit?
CSS/HTML
Interesting problem
What are your Firefox extensions
What's New in Pocket Internet Explorer
Upload files in "web-email site" style
Web developer
Visual Web Developer 2010 Express and Website Issues
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.