php脚本关闭,触发错误处理程序,500内部服务器

I am running a php script as a background process via ssh using the following command

php {path/to/script} &

I have the following error handler set in my php script:

function customError($errno, $errstr,$error_file,$error_line,$error_context)
  {
       file_put_contents('logName',"
Error String: ".$errstr." on line: ".$error_line,FILE_APPEND);
           file_put_contents('logName',"
Some Variable Value: ".$error_context['someVariableName'],FILE_APPEND);
           file_put_contents('logName',"
Error String: ".$errstr." on line: ".$error_line,FILE_APPEND);
  }

set_error_handler("customError");

The script runs for a while successfully but then it stops with no error being written to the log. When it stops the message below appears in the ssh console.

{my_host_user}@{my_domain_name} [~path/to/phpfile]# Status: 500 Internal Server Error
Set-Cookie: PHPSESSID={some_sessionID}; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/html

Can anyone suggest what's going wrong and/or a good tack for debugging this.