I have created some directories using mkdir($path,0755) Now when I want to delete the directory I get permission error and when I want to change the permission using chmod, I get the same error. I am also not able to change permission using FTP program or dreamweaver. What do I do?
Hello When you create files and directorys with PHP the owner may not get to be the same as when you upload or create them with your ftp program or Dreamveaver. Usually when files or directorys are created with PHP the owner gets to be "nobody". When you log in with Dreamweaver or ftp program, you log in as the owner of the account and not as "nobody". This I believe is whats causing your problem. Unfortunately Dreamweaver and most ftp programs can't change owner on files and directorys. You have a few options on what to do. In your script, either use the chown('/path/to/file/or/dir, 'owner_here'); command to change owner or use the unlink('path/to/file/'); command to delete files and rmdir('/path/to/directory'); to remove directorys (the dir must be empty though). You will find some useful tips and codesnippets following above links to the manual. You could set the owner at the same time as you create files and directorys to avoid this annoyment If you dont want to go trough this trouble, I recommend you to check out winscp. It's a free ftp/ssh program. With winscp you can easily execute ssh commands that does these tasks in the most easy and efficient way and a lot faster. Like changing owner or removing dirs and files all at once using ssh commands. Ok, just my $0,02. Good luck
Just login to cpanel and using filemanager you can create folder with required permissions Regarding the folder you have created if you want it to be deleted ask the hosting provider they will delete it for you Regards Alex
if you have root access or a super user, you can change the owner of the file like so. chown user:user file.php chown -R user:user folder
I've never used Dreamweaver, but many FTP clients allow sending raw commands to the server, in which case you can do something like "SITE chmod 0775 dirname". It's rare that the web server process would have the rights to change a file's owner. To do this it would have to be running as root. In general, if you have write permission on a directory, then you can remove files or directories contained therein, even if you don't actually have permissions on those files or directories. So make sure that the user who is trying to delete the files is allowed to write to the parent directory and the problem goes away.