Users authorized to call osascript from PHP

I have a little blurb in a PHP page that calls an applescript to retrieve some application data…

$myPath = realpath(“.”);
$scriptPath = $myPath . “/scripts/spreadServe_BookList.app”;
$cmd = “/usr/bin/osascript '”.$scriptPath.“'”;
$retValue = exec($cmd, $retcode); //$retcode = 0 for OK, 1 for error

This command produces the following console error…

Sep 20 23:47:06 powerbook /usr/bin/osascript: kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only

Do I need to add a sudo, or is there some other way to make this work?

Thanks in advance…