chmod 777 is required. Not a security issue, 777 folders can be used by hacker, but only when hacker get it. It is impossible to avoid having folders with 777 permissions.