Monday, January 24, 2011

permissions on upload folder not working

I have a php script which uploads images to a folder.

I have these permissions on the upload folder:

  drwxrwxr--  4 user user   4096 2010-06-02 16:20 temp_images

Shouldn't these permissions be enough for files to be uploaded to the folder?

But this doesn't work.

It only works when I set the permissions to 777.

"user" is added to the www-data group, still no luck.

Any ideas why?

  • If safe_mode is on, then user should be the apache/php user unless you set safe_mode_gid to on where check is done on group instead of user

    Camran : what do you mean? if safe_mode is off, then apache user doesn't matter?
    radius : see Zoredache answer, I miss readed something in your question
    From radius
  • Your folder is owned by the user and group user. If apache is running as a different account, perhaps www-data then apache will not be able to write there. Adding the user account to the www-data group would mean that user is permitted to write in folders that the www-data group owns and is set for rw. If you want apache to write to the folder the group user owns the apache service account must be a member of the user group.

    From Zoredache
  • The owner of the directory should be the effective userid of the web servers. Try changing the ownership, then you can set the permissions to 700, 750, or 755.

    chown www-data temp_images

    From BillThor

0 comments:

Post a Comment