(Sorry, ideally this would have been just been a comment, sans-speculation, if I was able to post one)
I notice based on your access log that your script's output is fairly large (602778 bytes formed from what I believe is only 200 of your original 300 records), and after performing a quick test for myself, the script could potentially consume several megabytes of memory when it gets called. That's certainly nothing outrageous, but if your new host is super-stringy about their setting of
php.ini, exceeding this value would raise E_FATAL in PHP, which could in turn generate the internal server error.
Admittedly, this scenario seems very unlikely to me, but it would explain why the problem manifested when you changed to a new host and why it 'magically' appeared after working fine earlier, provided the so-called problem HTML came from a slightly smaller result set when you viewed it before.
In any case, imaginative guessing on my part aside, you should have access to your
php_error.log file, which would show if PHP was causing any sort of fatal error, and that would help debug your problem further.