RE: Warning: chmod(): Operation not permitted ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> "chmod() can only change the permissions of files that are owned by 
> the user running the command. In most cases, this is the user that 
> the web server runs on."
> 
> That confuses me, because who's the user here? Is it just the system 
> administrator or the application?

This is the user that Apache (or whatever webserver) is running as.  If
you're using Apache, look at your httpd.conf file to find out who that
user is.  If you're creating files successfully, you can just look at
the owner of that file to find out who it is.

Is safe_mode enabled?

>From the manual (http://us3.php.net/chmod):

Note:  When safe mode is enabled, PHP checks whether the files or
directories you are about to operate on have the same UID (owner) as the
script that is being executed. In addition, you cannot set the SUID,
SGID and sticky bits.

So, if you're running in safe mode, the php file, and the files that you
need to modify have to be owned by the same user.

Say you have process.php which is operating on the uploaded files, and
it is owned by the jondoe user.  The files that you wanted to chmod()
would also have to be owned by jondoe, which is probably not the case.
Apache is often run under the apache, www, or nobody user.

HTH,

Brady

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux