Jump to content

Archived

This topic is now archived and is closed to further replies.

timlondon

File permissions mystery

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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???

Share this post


Link to post
Share on other sites
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.


Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.