On Windows Server 2008 R2, I am trying to set up a scheduled task to automatically run a PHP script which then adjusts the SQlite database. I am using SQlite as I need to use a database file. Whenever I run the script, it returns this error:

But when I run it in the web browser, it works perfectly.
My code is:
$db = new PDO("sqlite:server_status.db");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * FROM stats";
$results = $db->query($sql);
foreach($results as $row) {
print_r($row);
}