May be a background-image isn't the correct tool here and an absolutely positioned IMG (positioned behind
other content), as in @pokra's solution would be better? This could be altered to simply:
<img src="bgimage.php" alt="" style="position: absolute;">
Which doesn't rely on the actual page being rendered by PHP.
How does bgimage.php work? Does it return a different image on every
(2) Or, may be... load the image in a hidden IMG element (nothing is currently set as the background-image of the DIV container). Get the dimensions of this image (as above) and then set the dimensions AND background-image of your DIV container to the same as the IMG element. Not that this is possible though?