Calling nessus from shell..

I am trying to code a php script that calls upon the "nessus" client; and formats the output into a HTML table. Somehow, my shell scripts don't seen to be working correctly...is my syntax messed up?

Here's what i got:

<CENTER><BR><BR><BR><BR>
<table width="" border="0" cellspacing="1" cellpadding="0" bgcolor="#B1B78B"><tr><td>
<table width="" border="0" cellspacing="1" cellpadding="8" bgcolor="#F6F7EB"><tr><TD WIDTH="100%" BGCOLOR="#B1B78B"><b>Our scanner found the following interesting ports on node <? echo $_SERVER[REMOTE_HOST]; ?>
<? echo $_SERVER[REMOTE_ADDR]; ?>: </b></TD>
</TR>
<TR><?
$target = $_SERVER[REMOTE_ADDR];
$fp=fopen($target,'w') or exit (LogError($target));
fputs($fp,$target);
fclose($fp);
exec ("/usr/sbin/bin/nessus -q -c /usr/local/httpd/htdocs/postnuke/.nessusrc localhost 1241 thomas nimda $target $nessusResult 2> clientError");
$arraySize = sizeof($nessusResult);
$x = 3;
while($x < $arraySize){
echo "<tr>
<td><b>" .$nessusResult[$x]. "</b></td>"; $x++; } ?>
</tr>

Thanks!