Link only answers are not considered good practice on StackOverflow, but the advice that is given here should generally NOT be followed up.
I would like to revert to this great answer on a similar question. I quote:
Please stop suggesting to use 777. You're making your file writeable by everyone, which pretty much means you lose all security that the permission system was designed for. If you suggest this, think about the consequences it may have on a poorly configured webserver: it would become incredibly easy to "hack" the website, by overwriting the files. So, don't.