Eric! Posted August 28, 2008 Share Posted August 28, 2008 Does anyone know how the PHP processes access local files for reading and writing? I can not make my scripts work with 640. Is there a way so that the world read setting are closed, but read is open to the user and group (640)? The error I get with 640 (but not with 644 permissions) is: Warning: fopen(test_file.txt) [function.fopen]: failed to open stream: Permission denied in /update_try.php on line 12 Also I can't get any of the PHP scripts to create a file without getting the following error (the directory and parent directories are set to 755): Warning: fopen(tempfile9685.htm) [function.fopen]: failed to open stream: Permission denied in /update_try.php on line 55 The code is very simple: $fh = fopen($filename, "w"); Is there something wrong with how the groups/permissions are setup? Link to comment https://forums.phpfreaks.com/topic/121728-php-file-permissions/ Share on other sites More sharing options...
DarkWater Posted August 28, 2008 Share Posted August 28, 2008 You need a 6 for world to write and a 4 to read, unless you can somehow use chown on your box. 644 - read 666 - write Link to comment https://forums.phpfreaks.com/topic/121728-php-file-permissions/#findComment-627944 Share on other sites More sharing options...
trq Posted August 28, 2008 Share Posted August 28, 2008 World does not to be readable/writable if the files are owned by the same group the apache process belong too. Link to comment https://forums.phpfreaks.com/topic/121728-php-file-permissions/#findComment-627955 Share on other sites More sharing options...
DarkWater Posted August 28, 2008 Share Posted August 28, 2008 World does not to be readable/writable if the files are owned by the same group the apache process belong too. Yeah, but it seems like that isn't the case for most shared hosts. I mean, some probably have it that way. Link to comment https://forums.phpfreaks.com/topic/121728-php-file-permissions/#findComment-628177 Share on other sites More sharing options...
Eric! Posted August 30, 2008 Author Share Posted August 30, 2008 So I need to get my shared host to put the process into my group. How would I make this request specifically to them? Do the php processes have a specific name that I can tell them to include into my group? By the way, I've tried chown and several other php tricks to try to change owners or permissions and all of them are denied access. Also the only way I can get PHP to write to a file is by setting the directory to 777, which seems like a bad idea. Or am I just paranoid? Link to comment https://forums.phpfreaks.com/topic/121728-php-file-permissions/#findComment-629756 Share on other sites More sharing options...
Eric! Posted September 2, 2008 Author Share Posted September 2, 2008 I'm getting desperate. Does anyone know what PHP process names need to be added into my group for local server so it can read/write my files? My host provider doesn't want to take the time to understand my problem and I don't want to open up all my files to the world. Please help! Link to comment https://forums.phpfreaks.com/topic/121728-php-file-permissions/#findComment-632293 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.