Cookies are not work normal

It’s this part of the error message that makes me wonder if the problem is white-space before the opening php bracket:

To me that implies that output started at line 1 of the code, so line 7 (which is probably the setcookie() function) can’t run. I must admit I can’t remember if error line numbers are base zero or one.