My guess is that your output contains PHP error messages, such as:
Fatal error: Class 'PieGraph' not found
Browsers tend to make it difficult to inspect the source code of a script that generates an image but you should find a way to do it. Commenting out this line:
$graph->Stroke();
... can be a starting point.