Jump to content


Photo

File permissions mystery


  • Please log in to reply
3 replies to this topic

#1 timlondon

timlondon
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 15 July 2006 - 01:44 PM

I have a script which succesfully changes the permission of jpg files and moves them to another folder. The strange thing is that even though the script works perfectly it gives me the following errors for each file moved:

Warning: chmod(): Operation not permitted in...

Warning: rename(...

I don't understand why the error messages are being generated if the script works.

Any ideas?

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 15 July 2006 - 01:48 PM

it meants the script does not work perfectly.

You should aware that PHP run under user permission, so, since user can not change the file permission, php can't either.
Life's too short for arguing.

#3 timlondon

timlondon
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts

Posted 15 July 2006 - 01:57 PM

So should I be concerned about this? After all, the script does its job and both changes the file permissions and moves it to another folder???

#4 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 15 July 2006 - 02:10 PM

what exactly are you working on?  I suppose some sort of file uploading mechanism.

Normally, I'd set the permission for destination folder to world writable.  Of course, no change need to make to source folder.

So, that'd left you with 2 choices, should you set it to writable, or set it to writable, move the file, then set it back to readonly.

easy choice would be set the folder to writable.
the second choice need a little more work.  The idea is using php to create a connection to your ftp server using your username and password.  With this, you gain full access to your site, and you can change the destination folder to writable, move the file, then change back to readonly.

I have worked on similar problem, and as far as I've known, there is no other way unless you have control over PHP installation.



Life's too short for arguing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users