This is NOT a cookie/php.ini problem.
Sending cookies is done in the html headers, which must always be the first thing
that is sent to a browser.
What you need to do is make sure that your script does not print anything, not even a single whitespace, before you send any cookies.
Right now, your script sends some html (or a newline character or whatever)
and then tries to send a header, which is not allowed.