
02-03-04, 03:52 AM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Creating a 666 file?
Hi again.
I've written a script to edit an exsisting file (that is chmoded to 666) and everthing's fine, but what 'thing' (i can't remember the offical name) should i use if i want to view the file, and if it doesn't exsist, create it?
For example:
That's what i have at the moment, with save.php being:
That would edit file.php which is an already exsisting file that is chmoded to 666.
Now what would i use in place of r and w to view/write the file but if it doesn't exsist in either case, create it?
Also, is it possible for the file it creates to be automatically chmoded to 666 so i can edit it? That would be quite useful.
Thanks alot 
|

02-03-04, 06:54 AM
|
 |
Community VIP
|
|
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
|
|
either using the 'a' (append) flag or 'w' (write) one , if the file wasn't found, PHP will attempt to create it..
and I don't think it's possible to write on a file or even read with 0666 mode! if I recall right this one makes the file forbbiden to view/right .. 0777 is the one that allows editing ...
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
|

02-03-04, 07:28 AM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
When i use append it doesn't read the files involved, is there one that will do all three? For me 666 works fine, so is it possible for the file it creates to be automatically chmoded to 666 so i can edit it? Thanks
|

02-04-04, 03:33 AM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
For example, with append it allows me to write and create but not read. With read it allows me to read and write but not create. I need something that will do all three really. Anyone?
Also, can, when i create the file, it be automatically chomded to 666?
Thanks
|

02-04-04, 03:46 AM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Nevermind, i've made it readable by just doing the command twice as follows:
It works, but would it in the long run? Also, i'm still confused over the matter involving the creation of a file automatically chmoded to 666.
|

02-04-04, 11:02 AM
|
|
New Member
|
|
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
and I don't think it's possible to write on a file or even read with 0666 mode! if I recall right this one makes the file forbbiden to view/right .. 0777 is the one that allows editing ...
|
as I understand it....
1st number is owner's permissions
2nd is the group's permissions
3rd is everyone else's permissions
7 gives read, write & execute
6 gives read & write.... but no execute
|

02-04-04, 12:47 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
my server doesn't like a+ (don't ask why), but i got that working anyway...
i understand permissions, but i just want to know if it is possible for a form to chmod somethong to 666, or whatever persmission, when it creayes the file. thanks
|

02-04-04, 01:26 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
When i normally use...
...in chmod.php, it comes up with...
Quote:
|
Warning: chmod() [function.chmod]: Operation not permitted in /users/web/blah/web/chmod.php on line 2
|
Any ideas why it does that, too?
|

02-08-04, 04:48 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2003
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

02-08-04, 05:35 PM
|
|
New Member
|
|
Join Date: Feb 2004
Location: Los Angeles CA
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by tsb
When i normally use...
...in chmod.php, it comes up with...
Any ideas why it does that, too?
|
Remember two things, one, if it's a windows server, that ain't going to work anyway, but there's a real good change that's exactly the error you would get. The other thing to remember is that PHP access the file system on a *nix box as a user. If for some reason that user doesn't have appropriate permissions in the given directory you could get that. Although, PHP created the file, it doesn't take ownership, so this is very possible.
Nicholas Fitzgerald
http://www.axelis.com
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|