Thursday 17 March 2011

PHP: Cannot send session cookie - headers already sent by .. on line 1

Just a quickie which may save you a bit of time - certainly buggered me up for a few minutes.

If you're doing something in PHP which requires starting a session, writing a cookie, etc and you get the dreaded "headers already sent" error, e.g: "Cannot send session cookie - headers already sent by xxx.php;1" - and the error line indicated after the semi colon is the first line, what do you do?

It's normally because you've got content above the header output - which means it can't be sent, but if it's line 1 at fault, theres normally no content.

Easy - at least in my case - check your file is saved on the server in UTF8 format - NOT ANSI. I was using Beyond Compare to upload/edit a file and it had changed the format without telling me - quick tweak - and everyone is happy again!

Friday 11 March 2011

Tinned Mince and Moving House

Hmm. Possibly my wierdest blog title ever. Well, probably not, but hey it's still a little odd.

The recent lack of activity here (I really should stop apologising for not blogging often) is because we're in the process of buying a new house (well, cottage), and frankly it's eaten what little spare time is normally left after work.

Packing is in progress now and further updates will follow assuming all goes to plan.

In unrelated news, if you're into food, as I am (and thats why/how you found me here, perhaps), you should check out a relatively new foodie forum: Tinned Mince. It's much better than /actual/ tinned mince, which I suspect is probably not very nice.