opkg update
opkg install php5-cli php5-mod-pgsql
nano pgsql.php
#!/usr/bin/php-cli
<?php
$db = pg_connect("host='192.168.0.240' user='postgres' password='password' dbname='mypgdatabase'");
$grab_people = pg_query("select username, password from login");
$person = pg_fetch_assoc($grab_people);
print_r($person);
print pg_last_error();
pg_free_result($grab_people);
pg_close($db);
?>
chmod 755 pgsql.php
./pgsql.php
Array
(
    [username] => sonnyyu
    [password] => password
)