php mods to use PDO and return json