How to delete files created by Apache user?

Written by - 0 comments

Published on January 16th 2010 - Listed in PHP


There is one problem on shared hosting servers with Apache and PHP running on it: If a PHP script creates files and folders the owner of those created files is the user under which Apache is running, that's mostly www-data or wwwrun. User's accessing their webaccount by ftp and wanting to delete such files receive a permission denied error - because (of course) they're not allowed to delete those files. Here an example of an ls -l output:

-rw-r--r-- 1 www-data www-data 0 2010-01-16 18:30 file1 -rw-r--r-- 1 www-data www-data 0 2010-01-16 18:30 file2 -rw-r--r-- 1 www-data www-data 0 2010-01-16 18:30 file3 drwxr-xr-x 2 www-data www-data 4.0K 2010-01-16 18:30 testfolder1 drwxr-xr-x 2 www-data www-data 4.0K 2010-01-16 18:30 testfolder2 drwxr-xr-x 2 www-data www-data 4.0K 2010-01-16 18:30 testfolder3

So if you're someone who was seeking for a solution when you can't delete the files with your ftp user, this is it! Find more information in IT Howto's / PHP Script: Delete files and folders created by Apache user.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.