Discussion:
[PHP-INSTALL] undefined function pg_connect()
James Chubb
2008-11-21 05:59:16 UTC
Permalink
Hello,

I wonder if someone could help me resolve this problem.

Today, after upgrading from PHP 5.2.3. to 5.2.6, this little program:

<?php
$db = pg_connect('host=localhost dbname=xxxx user=chubb
password=yyyyyy')
or die('Could not connect: ' . pg_last_error());
?>

is now getting this error:

*Fatal error*: Call to undefined function pg_connect() in *
C:\Inetpub\cu\code_tests\db_connect.php* on line *2

*
According to phpinfo() ...

Server API: ISAPI
Loaded Configuration File: C:\Program Files\PHP\php.ini
PHP Extension: 20060613
Path environment variable: C:\Program
Files\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\QuickTime\QTSystem\

In the php.ini file, I do have:
extension=php_pgsql.dll

And on my system, I do have:
C:\Program Files\PHP\ext\php_pgsql.dll (98,368 2008-05-02 18:07)

I am running Windows/XP and IIS 5.1.

What is causing this problem?

Many thanks
jfc
Lester Caine
2008-11-21 07:35:26 UTC
Permalink
Post by James Chubb
Hello,
I wonder if someone could help me resolve this problem.
Today, after upgrading from PHP 5.2.3. <http://5.2.3.> to 5.2.6, this
<?php
$db = pg_connect('host=localhost dbname=xxxx user=chubb
password=yyyyyy')
or die('Could not connect: ' . pg_last_error());
?>
*Fatal error*: Call to undefined function pg_connect() in
*C:\Inetpub\cu\code_tests\db_connect.php* on line *2
*
According to phpinfo() ...
Server API: ISAPI
Loaded Configuration File: C:\Program Files\PHP\php.ini
PHP Extension: 20060613
Path environment variable: C:\Program
Files\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\QuickTime\QTSystem\
But is it showing pgsql installed?
Post by James Chubb
extension=php_pgsql.dll
C:\Program Files\PHP\ext\php_pgsql.dll (98,368 2008-05-02 18:07)
I am running Windows/XP and IIS 5.1.
What is causing this problem?
I would suspect it's not finding postgres so php_pgsql is not actually
being installed when php starts.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
James Chubb
2008-11-21 14:53:59 UTC
Permalink
Yes, Postgres is installed. I can access it via pgAdmin III and can query
the databases.

Is there something I should be doing to ensure PHP finds Postgres?

Thanks
jfc
Post by Lester Caine
Post by James Chubb
Hello,
I wonder if someone could help me resolve this problem.
Today, after upgrading from PHP 5.2.3. <http://5.2.3.> to 5.2.6, this
<?php
$db = pg_connect('host=localhost dbname=xxxx user=chubb
password=yyyyyy')
or die('Could not connect: ' . pg_last_error());
?>
*Fatal error*: Call to undefined function pg_connect() in
*C:\Inetpub\cu\code_tests\db_connect.php* on line *2
*
According to phpinfo() ...
Server API: ISAPI
Loaded Configuration File: C:\Program Files\PHP\php.ini
PHP Extension: 20060613
Path environment variable: C:\Program
Files\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\QuickTime\QTSystem\
But is it showing pgsql installed?
Post by James Chubb
extension=php_pgsql.dll
C:\Program Files\PHP\ext\php_pgsql.dll (98,368 2008-05-02 18:07)
I am running Windows/XP and IIS 5.1.
What is causing this problem?
I would suspect it's not finding postgres so php_pgsql is not actually
being installed when php starts.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
JamieC
2008-11-21 16:10:47 UTC
Permalink
SOLVED !!!

Yes, postgres is already installed. (My problem started when I upgraded
from PHP 5.2.3 to 5.2.6.)

After some more digging around, I found the following:

Bug <http://bugs.php.net/44905> *#44905 PHP 5.2.6 fails to load PostgreSQL
related libraries*

http://bugs.php.net/bug.php?id=44905

In the documentation for this bug is the circumvention which is

"Simply add your PostgreSQL bin directory ("C:\Program
Files\PostgreSQL\8.3\bin" on my system) to your system path."

I did this and the problem disappeared.

Thank you for your help.
jfc
Post by Lester Caine
Post by James Chubb
Hello,
I wonder if someone could help me resolve this problem.
Today, after upgrading from PHP 5.2.3. <http://5.2.3.> to 5.2.6, this
<?php
$db = pg_connect('host=localhost dbname=xxxx user=chubb
password=yyyyyy')
or die('Could not connect: ' . pg_last_error());
?>
*Fatal error*: Call to undefined function pg_connect() in
*C:\Inetpub\cu\code_tests\db_connect.php* on line *2
*
According to phpinfo() ...
Server API: ISAPI
Loaded Configuration File: C:\Program Files\PHP\php.ini
PHP Extension: 20060613
Path environment variable: C:\Program
Files\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\QuickTime\QTSystem\
But is it showing pgsql installed?
Post by James Chubb
extension=php_pgsql.dll
C:\Program Files\PHP\ext\php_pgsql.dll (98,368 2008-05-02 18:07)
I am running Windows/XP and IIS 5.1.
What is causing this problem?
I would suspect it's not finding postgres so php_pgsql is not actually
being installed when php starts.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
Loading...