non-object error due to session

Fatal Error: Call to a member function write() on a non-object