| Webspace & Domain Names This is a discussion on, File Permissions on the New System within the Freedom2Surf forum; I would appreciate if f2s would provide information about what file permissions should be, i.e. what are the defaults and ... |
![]() |
![]() |
|
LinkBack | Thread Tools | ![]() |
|
|
#1 |
|
Join Date: Jul 2002
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
|
File Permissions on the New System
I would appreciate if f2s would provide information about what file permissions should be, i.e. what are the defaults and what to expect when scripts create files, and anything else I should know about file permissions given the new system. For example, I discovered that I can have a PHP script create a new file and write to it even tho' the php script has 0644 permissions set. In the past when I worked with cgi's I remember it being mandatory to set an executable script to 0755. Is that not the case in the new system? If so, how come?
|
|
|
|
|
|
#2 |
|
Join Date: Jun 2004
Location: Kent
Posts: 3,760
Thanks: 1
Thanked 6 Times in 6 Posts
|
Moved from Q&A session forum to Webspace as the Q&A session is now over so shouldn't really go there.
The old webhosting servers ran PHP as an Apache module and the new ones run it as a CGI, so things are setup a bit differently. I think on the old servers all PHP scripts were run as the Apache user, so if you wanted to write to a file/folder in your webspace you had to give users other than yourself (the Apache user) write access to that file/folder. On the new servers PHP scripts are run as your own user on the servers (the same user that also owns the files in your webspace), so if you want to write to a file/folder you already have write access by default as they are owned by the same user you are running the script as. I'm not quite sure why you don't need 755 permissions to run the scripts, but I would guess it's because you aren't executing the scripts themselves directly (as no shebang is needed), but instead Apache passes them to the PHP interpreter for you (based on the file extension). That's my understanding of things - someone please correct me if I'm talking poop.
__________________
Adam |
|
|
|
|
|
#3 |
|
Join Date: Jul 2002
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
|
Thanks ...
Adam,
Thanks. Some of what you're saying makes sense. But it also raises other questions. Why if the scripts run under one user, ie me, then why when new files are created by php scripts do they have permissions set at 664? It would seem to me that logically I should expect them to have permissions of 644. The old f2s way back when had specific instructions about how files should be chmoded if one wanted to write to a file. Now things are a little less clear. As a user what I understand is that if I want to create a file and write to it my script can be 644 or 755 -- doesn't matter which I use. The newly created file will be set to 664 by default. If anyone wants to correct or add to my understanding, I'd welcome the feedback. Regards, php4ever |
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can't upload .mpg file to webspace | jonathancox | Webspace & Domain Names | 0 | 23-02-2006 10:42 AM |
| link to an exe file | paulo | Webspace & Domain Names | 7 | 15-01-2006 02:53 AM |
| FTP - File Permissions | phillcahill | Webspace & Domain Names | 2 | 04-07-2005 08:09 PM |
| Can't get file attributes | JeffG | Webspace & Domain Names | 5 | 02-05-2005 02:09 PM |
| php amend text file problem | coptang | Webspace & Domain Names | 5 | 25-04-2004 10:21 PM |
All times are GMT. The time now is 05:40 PM.








