After I download it offline to run it in my localhost, that error start appearing.
What do you mean by that? You can not download PHP code from a web page, can you?
Anyway, the error you are getting means that you are sending some HTML output before the session_start function. You can not do that since session_start sends a cookie and cookies are a part of a header. And header directives have to be sent before any HTML output. This includes any spaces that maybe you do not see in your code, as well as included files that also should not send HTML before headers. The solution is to put the session_start function on the very beginning of the code (as it says in the comment).