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:

<?php
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;
}

pg_free_result($result);
pg_close($dbconn);

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 3.6.0.201509151953.

I installed the php-pgsql package which installed:
[cmarshall@Lummi ~]$ rpm -ql php-pgsql.x86_64
/etc/php-zts.d/20-pgsql.ini
/etc/php-zts.d/30-pdo_pgsql.ini
/etc/php.d/20-pgsql.ini
/etc/php.d/30-pdo_pgsql.ini
/usr/lib64/php-zts/modules/pdo_pgsql.so
/usr/lib64/php-zts/modules/pgsql.so
/usr/lib64/php/modules/pdo_pgsql.so
/usr/lib64/php/modules/pgsql.so

So what do I need to do?

thanks,
Chris
Previous Topic:IllegalArgumentException for ProjectScope.java:57 when trying to view git revisions of PHP files
Next Topic:RUN as PHP CLI
Goto Forum:
  


Current Time: Sat Oct 12 16:04:10 GMT 2024

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

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

Back to the top