Chmod mod refers to the permission of the files
1 is for execute
2 for read
4 for write
Use 777 only when it is necessary since it is quite dangerous and free for all.
They add up to 7, for 7 you are giving all rights read, write and execute.
The 3 "7" refers to