Hanky Panky February 2016
So you are creating an array with 175K rows, just for the sake of counting the number of rows. That is bound to create memory issues. Even if you manage to resolve that its pointless to do that.
For an insight, 134217728 bytes ~ 134 MB. So you're reading more than 134 MB worth of data per call of that query which in itself is an issue even if you manage to suppress the error.
You can simply change your query to ask sqllite what's the row count.
SELECT count(*) as c FROM MYTABLE
Then you have only 1 row with the row count, use that.
$row = $result->fetch(PDO::FETCH_ASSOC);
echo "Rows: " . $row["c"] . "\n";
This can help answer why is it not generating an error in CLI mode