Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Postgres and PDT(undefined function pg_connect)
Postgres and PDT [message #1723462] Mon, 15 February 2016 19:25
Chris Marshall is currently offline Chris MarshallFriend
Messages: 1
Registered: February 2016
Junior Member
I have used Eclipse for years with Java and some with Python and Ruby. I am new to PHP and I am just learning my way around.
I have a php script that works when it is served through my web server (Apache) but does not when I attempt to run it in the debugger within Eclipse (tried both Zend Debugger and XDebug). The PDT content assist does seem to know about the postgres library. The error I am getting is:

PHP Fatal error: Call to undefined function pg_connect() in /home/cmarshall/DrupalWorkspace/DatabaseAccessExperiment/USGSQuadJSON.php on line 4

The code is pretty simple:

header("Content-Type: application/json");

$dbconn = pg_connect("host=localhost dbname=maps user=maps password=xxxxxx")
or die ('Could not connect: ' . pg_last_error());

$quadName = 'Milford';
if (isset($_GET["quadName"])){
$quadName = $_GET["quadName"];
$result = pg_query_params("SELECT * FROM USGSQuad WHERE quadname = $1", array($quadName))
or die ('Query failed ' . pg_last_error());

$data = array();
while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$data[] = $row;


echo json_encode($data);

The error would seem to say that I don't have a library configured correctly but being new to php it's not clear to me which library.

Everything is installed on Linux (Fedora 23), Eclipse Mars 4.5.1 with PDT

I installed the php-pgsql package which installed:
[cmarshall@Lummi ~]$ rpm -ql php-pgsql.x86_64

So what do I need to do?

Previous Topic:IllegalArgumentException for when trying to view git revisions of PHP files
Next Topic:RUN as PHP CLI
Goto Forum:

Current Time: Wed Nov 14 00:06:49 GMT 2018

Powered by FUDForum. Page generated in 0.02088 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top