| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Comfy Contributor
Joined in Aug 2005
Lives in Netherlands
Hosted on Pass48
124 posts
Gave thanks: 0
Thanked 0 times
|
[PHP] Folder/Files deleting permission problems
I was messing around with the mkdir(); and copy(); functions of PHP.
Then I created the directories and copied the files into them like it should. Only they were test dir's, and now I can't delete them anymore. My FTP client says this : "550 Could not delete blah.jpg: Permission denied". I can't remove/rename/move the file anywhere, also not by the Cpanel Filemanager. When I try to chmod it I get this : "550 Could not change perms on blah.jpg: Bad file descriptor" I can't also upload any files anymore in those directories where that file is. But I can rename the folder the file is in, only not delete it Anybody an idea to remove them? I used this in my php file : PHP Code:
Thanks ![]() |
|
|
|
|
|
#2 (permalink) |
|
Registered User
Comfy Contributor
Joined in May 2003
Lives in Florida
118 posts
Gave thanks: 0
Thanked 0 times
|
Hello Z`ohki,
The PHP function mkdir() doesn't create directories under your name but instead by the process running PHP which is usually 'nobody'. Since the directory isn't created under your name you therefore don't have persmission to delete the directory. To delete the directory use the PHP function rmdir() which is remove directory; since it also uses the PHP process user it'll have permissions to delete the folder. As for alternatives to your solution, you're going to have to use PHP's ftp functions and have it login to your ftp with your username and password and use the ftp mkdir function which is ftp_mkdir(). You can find lots of working examples of scripts already made to do just that by reading the comments on PHP's site for the mkdir() function here http://us2.php.net/mkdir
__________________
Profession: Programmer, Gamer, Web Developer Website: http://www.reanimated.net/ - Server: Quela Last edited by OmicroN; August 23rd, 2005 at 10:53 PM.. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Comfy Contributor
Joined in Aug 2005
Lives in Netherlands
Hosted on Pass48
124 posts
Gave thanks: 0
Thanked 0 times
|
Thanks I got it now, I had tried with rmdir(); as well before posting, only it said that it wasn't empty all the time. So I tried with 'delete()' but that didn't work.
I saw unlink() at php.net, only I didn't know it was for deleting files as well. But I just used that and now I can remove them. Thanks for the help! ![]() |
|
|
|