Cant access PHP generated files via FTP
I have a form that uploads files and stores them in an uploads folder in my httpdocs folder. However, if I try to delete or rename one of those files via ftp, it wont let me. Wh开发者_运维百科y?
The user your web server runs as (apache
, or perhaps www-data
or httpd
for Apache) probably owns the PHP-created files. The permissions on them may prevent your FTP user from writing to them.
Because php works under apache username, so you don't have rights to delete other users files. You need to have apache in the same group as your username, or delete using apache username (by scripts, manually, etc.)
Why it happens has just been already answered.
You can avoid this by using the chmod
function giving to the uploaded file the right permission.
Es:
chmod($filename,666)
see here: http://it.php.net/chmod
精彩评论