I'm trying to rename a folder from a php file and it's giving me an error. I'm getting a 'Permission Denied' error, but the folder chmod is 777 so I don't understand why I'm getting this error.
Can you post your script please. it is sure weird, unless you didnt chmod the folder correctly, or the error is in your own script.
I know the error is not a syntax error with my code because it's denying permission, not giving me a syntax error. Here is the part where I do the actual rename though: $oldFolder = $config['sitePath'] . $row['videoFolder']; $newFolder = $config['sitePath'] . $random; rename($oldFolder,$newFolder) or die("Could not rename directory"); PHP:
Try echoing out $oldFolder and $newFolder it may not be where you expect it to be... Simple mistake but easily made. Look for ownerships of the folder but if they are 777 then I don't see why this would happen. Interestingly a comment on the php manual pages suggests that directorys can't have the final slash on the end or the function does not work correctly.
Exactly what he said, go over the code like this: $oldFolder = $config['sitePath'] . $row['videoFolder']; $newFolder = $config['sitePath'] . $random; echo $oldFolder . "<-- OLD Folder <br />"; echo $newFolder . "<-- NEW Folder <br />"; and check the results, the problem is most likely there...
The problem was with the owner/group of the folder. I made a group that included all the possible users that would mod the folder and chgrp'ed to that group. Problem fixed