wrong user/group when files are created with fopen

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Master of Puppets_it
Posts: 15
Joined: Tue Feb 24, 2004 6:54 pm

wrong user/group when files are created with fopen

Post by Master of Puppets_it »

When i use fopen() to open files, they have the wrong user/group, and can't modify them to where i have write priveleges. I'm on linux, and recently i've moved to a local server.

$open=fopen("file.php","a");

This will open the file, and let me write to it once.(What I write to it on the starting script) But if I call an fopen() to open it in a different script, I get the error that its not a valid resource. I'm guessing the reason is there is no write permission. How can i change the user/group from 'wwwrun/www' inside the script? or maybe change something else that makes files created by an fopen command 'me/mygroup'. Can someone help?

Archived topic from Iceteks, old topic ID:2193, old post ID:18577
User avatar
Red Squirrel
Posts: 29206
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

wrong user/group when files are created with fopen

Post by Red Squirrel »

Hmmm weird.... if it's chmodded to 777 any user should be able to access it, and fopen chmods to 777 by default I believe. Maybe check php.ini to make sure this is in fact right, maybe there's a setting in there somewhere. I never seen one but never looked far in that file either. Had a few things to change in it and that's it.

Archived topic from Iceteks, old topic ID:2193, old post ID:18580
Honk if you love Jesus, text if you want to meet Him!
Fat Cat
Posts: 16
Joined: Wed Mar 31, 2004 8:33 pm

wrong user/group when files are created with fopen

Post by Fat Cat »

this may be a stupid suggestion from a newbie, but have you closed the file at the end of each write script ? (fclose) . If left open you won't be able to reopen it.

Archived topic from Iceteks, old topic ID:2193, old post ID:18641
Locked