Re: fopen() and persmissions

From: Date: Fri, 11 May 2001 19:00:53 +0000
Subject: Re: fopen() and persmissions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52501@lists.php.net to get a copy of this message
On Thu, May 10, 2001 at 10:42:10PM -0300, Christian Dechery wrote: > as I've seen PHP running as Apache module cannot create or update files... > it gives me 'permission denied'... > so I've tried these solutions: > > * > fopen("ftp://user:password@myftpserver.com/directory/newfile.ext","w"); > this actually works... but only for "w"... if I wanna update this file, > like "a", it can't be done as it says the file already exists... so I'd > have to read it entirely, add the new data and write it back... (not so > good).... This is completely expected behavior as your are using ftp. Since it is a file transfer protocol, you can't do much other than transfer files and browse directories. > * chmod 777 in the dir I am... so 'nobody' (apache user) can write to it... > but what happens is that, the file isn't mine... it belongs to nobody... so > I have no rights to it in FTP or telnet... I would never make a file chmod 777. That seems to dangerous to me. I think you could add yourself to the same group that nobody belongs to and then you could edit the file if it is chmod 666 or something like that. I'm not a Linux expert by any means, so there is probably an even more secure way. > is there a better solution then either of these two??? Not that I'm aware of. I would probably use the 2nd method. -- Jason Stechschulte jpstech@unoh.edu -- I suppose one could claim that an undocumented feature has no semantics. :-( -- Larry Wall in <199710290036.QAA01818@wall.org>

« previous php.general (#52501) next »