Changing Root Permission

The error message

chmod 777 ./ chmod: changing permissions of './': Read-only file system

Says that the root file system is mounted read-only. This is not a problem with the permissions, but for some reason the FS was (re)mounted read-only, possibly because of filesystem errors on boot or some kernel exception.

This said, you should almost never use permissions 777 as they allow everyone, including the user nobody that is made for processes that should have minimal permissions, to read and write your files. Use permissions like 755 or 750 and chown the files and folders to allow the correct user and group to access them.