The strange this is that user has writing access to the file, and so
does his group. I even changed permissions to rw-rw-rw and the script
could still not write in the file. The only solution came when I told
the server manager to change the files owner to thttpd (not apache as
mentioned above, it was only as an example) and then the script worked.
I still wonder why this occurs and if there is any solution to it.

Arty2


-----Original Message-----
From: Martin Hudec [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 08, 2003 5:32 PM
To: George Papatheodorou
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] about writing permissions

Hello,

On Tuesday July 8 2003 15:42, George Papatheodorou wrote:
> I noticed that in all versions before php5 (I haven't seen this one
> yet), a script cannot open a file for writing mode is the file's
> owner is different from php's owner.  

if user2 other than owner is trying to write to file which does not have

permission to write for group in which user2 is, or write for others, 
then write will fail

like in

rw-r--r-- user group file.txt
only user has permission to write

or in

rw-rw-r-- user group file.txt
only user and users attached to group have permission to write...

> Eg when php's owner is apache
> and test.php's owner is user1, user1's script cannot write in
> test.php but it can write to test2.php which is owned by apache. 

All scripts on webserver run with owner/uid of apache (like nobody, 
apache or such), therefore you have to set correct permissions to 
files....

if test.php is set to rw-r--r-- user1 group then only user1 is allowed 
to write to it....

test2.php is set to rw-r--r-- apache group... so apache can write there

> there any solution to this problem? (except making apache own all
> files). Sorry if my question is kinda newbish or stupid and sorry for
> my poor english too. Thank you in advance.

solution is to set all files to be writable by group (rw-rw-r--) by 
chmod 664 and add apache owner/uid to group which is listed as 
ownergroup of that file (change group id of apache in its configuration 
file to group).

like

rw-rw-r--  user group test.php


I hope I have explained it a bit to you.

-- 
Martin Hudec
------------------------------------
 :@:  [EMAIL PROTECTED]
 :w:  http://www.corwin.sk
 :m:  +421.907.303.393

  "In google non est, ergo non est."
  - unknown IRC operator
------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to