For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > November 2006 > Undefined pg_prepare() in 5.1.6









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Undefined pg_prepare() in 5.1.6
Steve Mathias

2006-11-01, 6:57 pm

Hello,

I recently added new code (containing calls to pg_prepare and related
functions) to a system that had not previously used prepared statements,
and started getting "Call to undefined function pg_prepare()" errors. I
did a rebuild and install of apache 2.2.3 and PHP 5.1.6, using the
following configure line for PHP:
../configure --with-apxs2=/usr/local/apache/bin/apxs \
--with-pgsql=/usr/local/pgsql --with-mysql=/usr/local/mysql \
--enable-force-cgi-redirect --disable-cgi --with-zlib --with-gettext

The following code:

<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=test user=test password=test");
if(!$dbconn) {
echo "Unable to connect to test database\n";
echo pg_last_errror($dbconn);
exit;
}
// Prepare a query for execution
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM phone WHERE name = $1');
....
?>

still gives me this in the apache log:

[Wed Nov 01 09:42:48 2006] [error] [client xx.xxx.xxx.x] PHP Fatal error: Call to undefined function pg_prepare() in /usr/local/apache/htdocs/php/dbtest.php on line 9

Other than this, PHP and non-prepare related pg_* functions work fine.
php_info() reports that it sees version 8.0.3 of libpq. However, when I
do <?php print_r(get_extension_funcs("pgsql")); ?> I don't see
pg_prepare or any of the other post 5.1.0 pg_* functions.

I've not been able to find any help on this in the FAQ or by searching
the archives. I have other servers that I've set up more-or-less
identically to this one where everything works fine. It seems like this
must be something really stupid, but I'm stumped. Any help/pointers
would be greatly appreciated.

-Steve
--
( Stephen L. Mathias, Ph.D. ( s m a t h i a s (
) Division of Biocomputing ) @ p o b l a n o )
( UNM School of Medicine ( . h e a l t h . (
) ) u n m . e d u )
( http://poblano.health.unm.edu/ (
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com