+1  A: 

The xml-declaration must be on the absolute first line in the output. I.e. no blank lines or spaces before the xml-declaration tag.

This is valid:

<?xml version="1.0" encoding="UTF-8" ?>

This is not:

 <?xml version="1.0" encoding="UTF-8" ?>
PatrikAkerstrand
Thanks - it looks like this is the problem as there is a blank line first. Not sure why Zend is doing that though...
William
It might not be Zend - make sure you don't have any errant whitespace in your PHP.
MegaHAL
You are correct - it seems that a blank line after the closing ?> at the end of the PHP file was causing the problem. Many thanks.
William
You can safely omit the ?> at the end of PHP files to avoid this altogether
David Caunt
A: 

Check whether <?xml version="1.0" encoding="utf-8"?> is the first line in the feed file. No empty lines or spaces!

Shoban
A: 

If PHP is spitting out any notices/warnings or such, those will malform the feed. Try setting error_reporting to zero before the feed is sent to test:

error_reporting(0);
karim79
Alternatively, set error reporting to maximum, and fix the problem, rather than just hiding it. error_reporting(E_ALL|E_STRICT);
Alister Bulman
A: 

good rule of thumb when using php class files and such, never ?> your class files. Only use ?> in template-type files where you are going to have regular output afterwards. All of the major packages do this now for exactly the above reasoning.

Justin