|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
delete php created folder
Hi guys,
I have written a php code that create a folder and then copy some files from one folder in the server into it. The flow is like this. When the administrator click on the copy button i created, it will do the task by running the file i created (as mentioned above). After successfully created the folder and copied the files, i tried to delete it from ftp. Now this is the prob: The problem is can't delete it anymore because it says operation not permitted. Why i can't delete the folder created and files i copied ?? i When i check the owner from my files manager, i found that the owner for the folder created by the php code is WWW and not my username... why is that so ?? i guess that is the reason why i can't delete the files or folder. since i am not WWW user, how could i delete the files now ?? is it if i create files or copy files by using by using php, it will automatically set the owner as WWW and not my username ?? please advise. |
|
#2
|
||||
|
||||
|
Correct. The Web server can only create files using its username, which is typically either www or nobody. You could try having the script chown the file or change the group and permissions to a group your user belongs to so that you can then go in and delete.
|
|
#3
|
|||
|
|||
|
i have chmod the folder to 777 but it is not working... is it i have chmod all the files inside instead just the folder ?
|
|
#4
|
|||
|
|||
|
You must have your php script run this function:
chgrp() Hope that helps. |
|
#5
|
||||
|
||||
|
Right, the folder might be 777, but if the individual file permissions don't allow the www user to delete them, you're SOL. It's generally not considered a great idea to have 777 permissions, by the way.
|
|
#6
|
|||
|
|||
|
is it i need to use this code ?
chgrp ( $folder, WWW) rmdir($folder) please advise. |
|
#7
|
||||
|
||||
|
If the files aren't already owned or writable by the www user, you won't be able to use php to change the permissions or group/ownership. You'll need to log into the shell and issue "chgrp www *".
Also, I'm not sure about this, but I suspect you'll need to delete all the files in the folder prior to removing the folder. Look into the unlink() command to handle this. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > delete php created folder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|