I've uploaded some files into a directory i've created (using a php upload script). At first I didn't set the right chmod for dir. and files (411 instead of 777). Now this folder and files are stuck on the server, can't delete using FTP, cant delete using script: unlink/rmdir. I don't have server acces. Is there any way to still do this using PHP scripting?
Asked
Active
Viewed 299 times
2
-
1As long as you have created the directory you should be the owner and with 700 permission you can delete the directory (and the files in it) – Jun 09 '11 at 09:57
-
Now the permissions are 411. I am sure they were 700 earlier... – tvgemert Jun 10 '11 at 09:51
-
But user and owner are the same: apache. When I upload files to a directory which is set to 775 (using the upload script) owner and user are also apache AND I'm able to delete them. So only difference are the permissions. – tvgemert Jun 10 '11 at 09:57
2 Answers
0
There is PHP's chmod filesystem function, assuming PHP's process is the owner of dir, you can change permissions using it.

Grzegorz Rożniecki
- 101
- 2
0
If
chmod ("/somedir/somefile", 755); // php script code
does not work you still can try
unlink($filename); // php script code
and
rmdir($dirname); // php script code
to remove them. If this does not work then your apache-account on the server does not have the necessary rights to do that. I guess this should usually work cause your apache-account created those files.

Thariama
- 106
- 1
- 9
-
I understand, and this *should* work. But not in this case. (see my comments on the original question) – tvgemert Jun 10 '11 at 11:24