You are here: Re: rename(old file, new file) function Permission Denied « All PHP « IT news, forums, messages
Re: rename(old file, new file) function Permission Denied

Posted by Michael Vilain on 11/18/05 04:15

In article <ops0eo8y1or1c5ad@lancer>, Berimor <berimor@berimor.ber>
wrote:

> On Thu, 17 Nov 2005 23:57:58 +0800, chris <someone@here.com> wrote:
>
> > im trying to rename a file using the rename(old file, new file) function
> >
> > i have also tried the copy funtion also
> >
> > the folder that the files are in are chmod 755
> > and the files themself are chmod 644
> >
> > if i run the script on my own domain it works as expected
> >
> > however i am trying to run it on another domain on another server, the
> > files and directory have the same permissions as mentioned above but i get a
> > PHP Permission denied warning.
> >
> > my domain is running php 5.
> > the problem domain is running PHP 4.3.11
> >
> > any idea why this is not working
> >
>
>
>
> The problem is in Apache + general system configuration. The PHP
> interpretator by itself (or module - if installed as part of Apache )
> doesnt have enough rights to make such manipulations with file system. I
> have some domains with the same problem and tech guys usually says - we
> made this because of security reason. But i think that they are not
> expirienced enough and are not sure - that's why cosiders this as the best
> way to defend themselves from probable hacks.

If the code that's doing the rename is running as an Apache module
mod_php, then the process that's doing the rename is likely the Apache
process. It's probably running as nobody or www or apache. It may not
have write permissions to write into the directory where the newfile is
being placed.

To get around this, run php as a CGI script with the CGIwrap wrapper:

http://cgiwrap.sourceforge.net/

This will force the child process running the php code to run as a
specific user ID. It also requires that php be built as a command line
utility.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация