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

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

 



At 11:18 AM -0400 5/17/06, John Nichel wrote:
tedd wrote:
Hi (please insert your preference):

This should be simple, but I'm having problems.

I have a program that uploads an image file and then tries to set the permissions for the image (to be altered later). However, I get a "Warning: chmod(): Operation not permitted" error when trying to set the permission, what gives? If my program created the file, shouldn't it have permission to set the files permissions?

What am I not understanding?

Without seeing code, permissions of the directories, what sticky bits might or might not be set, etc., you could not be understanding many things....or just one....who knows.

I read all of your Google links, but no help. Just another example of how Google is not the answer.

In any event, my code is pretty simple, just:

chmod($url, 0755);  //where $url is the file I want to change.

The error I receive is noted above in the subject line.

The permissions of the directories vary, but the folder that has the file I want to change permissions is currently set at 0777.

In doing a lstat() of both the parent program that created the file and the child file shows that they both have the identical uid and gid (i.e., the same user and group id's).

Now, everything I've read, says:

chmod() changes the permission of the specified file with the following caveat.

"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?

And if it is just the system administrator, then can't the system admin change anything he/she wants anyway? What's the point of having uid and gid's if a program can't change the permissions of a sibling file?

I have tons of references as to what php filesystem functions are available, but I need a good reference as to what permissions are and how they actually can be changed in php -- does anyone have one a good reference OR care to explain?

As it is now, I know how ride the horse, but I can't get the gate open.

Thanks.

tedd

--
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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