Problem with pg_connect() in PHP

Поиск
Список
Период
Сортировка
Искать

Problem with pg_connect() in PHP

От:
James Kitambara <jameskitambara@yahoo.co.uk>
Дата:

Dear Members of

I have installed the Apache 2.0.61,  PHP 5.2.4 and PostgreSQL 8.1 on my local computer.

All three software were successfully tested. I changed “;extension=php_pgsql.dll”  to

“extension=php_pgsql.dll”    in the php.ini file in order to enable PostgreSQL in PHP.

The problem comes when I try to connect to the PostgreSQL Database using php function pg_connect

$dbconn = pg_connect("host=".PG_HOST_NAME." port=".PG_PORT_NUM."  dbname=".PG_DB_NAME." user=".PG_USER." password=".PG_PASSWORD);

All the arguments in the function pg_connect() are defined.

Unfortunately I am getting the Fatal error: “Call to undefined function pg_connect() in C:\Web\html\Staff_Management\example1.php on line 23”

C:\Web\html is my document root.

What could be the possible mistake?

Anyone to assist me!

Best regards,

James Kitambara


Re: Problem with pg_connect() in PHP

От:
Robert Edwards <bob@cs.anu.edu.au>
Дата:

Looks like you are missing the php_pgsql extension (I assume you
are running on a Windows server). On Debian GNU/Linux, it is called
php5-pgsql (or php4-pgsql, as appropriate). Not sure what it would
be called for Windows, but something similar.

Simply enabling it (by uncommenting the line in your php.ini file)
is not sufficient - the actual library needs to be installed as well.

Cheers,

Bob Edwards.

James Kitambara wrote:
> Dear Members of
> 
> I have installed the Apache 2.0.61,  PHP 5.2.4 and PostgreSQL 8.1 on my 
> local computer.
> 
> All three software were successfully tested. I changed 
> “/;extension=php_pgsql.dll”/  to
> 
> /“extension=php_pgsql.dll”/    in the php.ini file in order to enable 
> PostgreSQL in PHP.
> 
> The problem comes when I try to connect to the PostgreSQL Database using 
> php function pg_connect
> 
> $dbconn = pg_connect("host=".PG_HOST_NAME." port=".PG_PORT_NUM." 
>  dbname=".PG_DB_NAME." user=".PG_USER." password=".PG_PASSWORD);
> 
> All the arguments in the function pg_connect() are defined.
> 
> Unfortunately I am getting the Fatal error: “/Call to undefined function 
> pg_connect() in C:\Web\html\Staff_Management\example1.php on line 23/”
> 
> C:\Web\html is my document root.
> 
> What could be the possible mistake?
> 
> Anyone to assist me!
> 
> Best regards,
> 
> James Kitambara
> 
> 


Re: Problem with pg_connect() in PHP

От:
"Edward W. Rouse" <erouse@comsquared.com>
Дата:

Can I assume the missing ‘.”’ From the end of PG_PASSWORD is a cut and paste error?

 

Edward W. Rouse

 

From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of James Kitambara
Sent: Friday, September 26, 2008 1:22 AM
To: pgsql-sql
Cc: Kenichiro Arakaki; Ken Arakaki
Subject: [SQL] Problem with pg_connect() in PHP

 

Dear Members of

I have installed the Apache 2.0.61,  PHP 5.2.4 and PostgreSQL 8.1 on my local computer.

All three software were successfully tested. I changed “;extension=php_pgsql.dll”  to

“extension=php_pgsql.dll”    in the php.ini file in order to enable PostgreSQL in PHP.

The problem comes when I try to connect to the PostgreSQL Database using php function pg_connect

$dbconn = pg_connect("host=".PG_HOST_NAME." port=".PG_PORT_NUM."  dbname=".PG_DB_NAME." user=".PG_USER." password=".PG_PASSWORD);

All the arguments in the function pg_connect() are defined.

Unfortunately I am getting the Fatal error: “Call to undefined function pg_connect() in C:\Web\html\Staff_Management\example1.php on line 23”

C:\Web\html is my document root.

What could be the possible mistake?

Anyone to assist me!

Best regards,

James Kitambara

 

Re: Problem with pg_connect() in PHP

От:
ries van Twisk <pg@rvt.dds.nl>
Дата:

On Sep 26, 2008, at 12:23 PM, Edward W. Rouse wrote:

Can I assume the missing ‘.”’ From the end of PG_PASSWORD is a cut and paste error?
 
Edward W. Rouse
 
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of James Kitambara
Sent: Friday, September 26, 2008 1:22 AM
To: pgsql-sql
Cc: Kenichiro Arakaki; Ken Arakaki
Subject: [SQL] Problem with pg_connect() in PHP
 
Dear Members of
I have installed the Apache 2.0.61,  PHP 5.2.4 and PostgreSQL 8.1 on my local computer.
All three software were successfully tested. I changed “;extension=php_pgsql.dll”  to
“extension=php_pgsql.dll”    in the php.ini file in order to enable PostgreSQL in PHP.
The problem comes when I try to connect to the PostgreSQL Database using php function pg_connect
$dbconn = pg_connect("host=".PG_HOST_NAME." port=".PG_PORT_NUM."  dbname=".PG_DB_NAME." user=".PG_USER." password=".PG_PASSWORD);
All the arguments in the function pg_connect() are defined.
Unfortunately I am getting the Fatal error: “Call to undefined function pg_connect() in C:\Web\html\Staff_Management\example1.php on line 23”
C:\Web\html is my document root.
What could be the possible mistake?
Anyone to assist me!
Best regards,
James Kitambara
 

Did you re-start apache after you made the changes to the php.ini file?

Ries








Re: Problem with pg_connect() in PHP

От:
Lennin Caro <lennin.caro@yahoo.com>
Дата:



--- On Fri, 9/26/08, Edward W. Rouse  wrote:

> From: Edward W. Rouse 
> Subject: Re: [SQL] Problem with pg_connect() in PHP
> To: "'pgsql-sql'" 
> Date: Friday, September 26, 2008, 5:23 PM
> Can I assume the missing ‘.”’ From the end of
> PG_PASSWORD is a cut and paste error?
> 
>  
> 
> Edward W. Rouse
> 
>  
> 
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of James
> Kitambara
> Sent: Friday, September 26, 2008 1:22 AM
> To: pgsql-sql
> Cc: Kenichiro Arakaki; Ken Arakaki
> Subject: [SQL] Problem with pg_connect() in PHP
> 
>  
> 
> 
> Dear Members of 
> 
> I have installed the Apache 2.0.61,  PHP 5.2.4 and
> PostgreSQL 8.1 on my local computer.
> 
> All three software were successfully tested. I changed
> “;extension=php_pgsql.dll”  to 
> 
> “extension=php_pgsql.dll”    in the php.ini file in
> order to enable PostgreSQL in PHP.
> 
> The problem comes when I try to connect to the PostgreSQL
> Database using php function pg_connect
> 
> $dbconn = pg_connect("host=".PG_HOST_NAME."
> port=".PG_PORT_NUM." 
> dbname=".PG_DB_NAME." user=".PG_USER."
> password=".PG_PASSWORD); 
> 
> All the arguments in the function pg_connect() are defined.
> 
> Unfortunately I am getting the Fatal error: “Call to
> undefined function pg_connect() in
> C:\Web\html\Staff_Management\example1.php on
> line 23”
> 
> C:\Web\html is my document root.
> 
> What could be the possible mistake? 
> 
> Anyone to assist me!
> 
> Best regards,
> 
> James Kitambara

first create a file that contains this



save this with php extension, run this file from the browser and seek for the directory extension, then look if the file php_pgsql.dll is there





FAQ