my best thought it to run that script you are having all those issues with in a php cli
Code:
$ cd /path/to/script/
PHP Code:
<?php
/*comment out for production*/
//error_reporting(E_ALL);
//ini_set( 'display_errors', true );
/**********************************/
put full error reporting on
Code:
$ php scriptname.php
maybe you will get some troubleshooting clues ...