Hi!, and a Question
am 04.06.2004 07:13:20 von David Cruz
Hello to everybody!
I'm David from Colombia.
I'm learning Postgresql and using PHP. And I'm trying
to connect from my php web page to PostgreSQL, I use
this function:
$connection = pg_connect("host=gatuno port=5432
dbname=cdtaller4_3");
and when I look it on the browser it shows:
Fatal error: Call to undefined function: pg_connect()
in /var/www/index2.php on line 8
- I have PostgreSQL 7.4 , Apache is working well, and
all other php scripts too. I'm using knoppix and I
looked at the KPackage and I have php4-pgsql
installed.
Does somebody know what could be happening?
thanks!
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Re: Hi!, and a Question
am 04.06.2004 07:34:50 von Christopher Kings-Lynne
> and when I look it on the browser it shows:
>
> Fatal error: Call to undefined function: pg_connect()
> in /var/www/index2.php on line 8
>
> - I have PostgreSQL 7.4 , Apache is working well, and
> all other php scripts too. I'm using knoppix and I
> looked at the KPackage and I have php4-pgsql
> installed.
You have not got pgsql support compiled into PHP.
Chris
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Re: Hi!, and a Question
am 04.06.2004 09:54:49 von Nick Barr
Christopher Kings-Lynne wrote:
>> and when I look it on the browser it shows:
>>
>> Fatal error: Call to undefined function: pg_connect()
>> in /var/www/index2.php on line 8
>>
>> - I have PostgreSQL 7.4 , Apache is working well, and
>> all other php scripts too. I'm using knoppix and I
>> looked at the KPackage and I have php4-pgsql
>> installed.
>
>
> You have not got pgsql support compiled into PHP.
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
>
>
Either PHP has not been compiled into PHP, or the extension has not been
turned on. Look in php.ini for a line looking like:
;extension=pgsql.so
and uncomment it (remove the ;) so it looks like:
extension=pgsql.so
HTH
Nick
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Re: Hi!, and a Question
am 08.06.2004 08:17:07 von David Cruz
Hi!, about this, I'm using it local, in the same
server is postgresql and the database and the apache
web server too. I have downloaded the php-pgsql again
and install it again, it was an rpm and i have knoppix
(debian), so I did it with #alien -i, I have this in
my php.ini
------
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded
automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; Note that it should be the name of the module only;
no directory information
; needs to go here. Specify the location of the
extension with the
; extension_dir directive above.
extension=pgsql.so
------
I have pgsql.so in /usr/lib/php4/20020429 which is the
place where phpinfo(); says it's searching for
extensions
-------
and my /etc/postgresql/pg_hba.conf says:
#
# TYPE DATABASE USER IP-ADDRESS
IP-MASK METHOD
# Database administrative login by UNIX sockets
local all all
trust
#
# All other connections by UNIX sockets
local all all
trust
#
# All IPv4 connections from localhost
host all all 127.0.0.1
255.255.255.0 trust
#
# All IPv6 localhost connections
host all all ::1
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust
host all all ::ffff:127.0.0.1/128
trust
#
# reject all other connection attempts
localhost all all 192.168.1.6
255.255.255.0 trust
-------
and the phpinfo page shows:
pgsql
PostgreSQL Support enabled
Active Persistent Links 0
Active Links 0
Directive Local Value Master Value
pgsql.allow_persistent On On
pgsql.auto_reset_persistent Off Off
pgsql.max_links Unlimited Unlimited
pgsql.max_persistent Unlimited Unlimited
-----
I don't know what am I doing but it doesn't work, when
I execute the php web page:
Ejemplo
$db = pg_connect("dbname=cdtaller4_3");
$query = "select * from empleados";
$result = pg_exec($db, $query);
if (!$result) {
printf ("ERROR");
$errormessage = pg_errormessage($db);
echo $errormessage;
exit;
}
?>
It doesn't shows any error or something it stays on
the same page it was, and do nothing...
Thanks...if somebody knows another configuration I'm
forgetting.. (PHP 4, Apache, PostgreSQL 7.4.2, Knoppix
3.4)
thanks!
--- CGMoller@StateStreet.com wrote:
>
> Question - You say other php scripts work, do they
> connect to the database
> too?
>
> I see you have not specified a user to connect to
> the database. I believe
> the host and port are necessary only if they are not
> local or using a
> different port.
> I use the following format to connect
>
> $db = pg_connect("dbname=performance user=browser");
> $query = "select * from my_table";
> $result = pg_exec($db, $query);
> if (!$result) {
> printf ("ERROR");
> $errormessage = pg_errormessage($db);
> echo $errormessage;
> exit;
> }
>
> Thanks
>
> Cameron
>
> +++++++++++++++++++++++++++++++++++++
> Cameron G. Moller, Senior Officer
> Technical Project Manager
> SSGM Infrastructure
> State Street Corporation ...
> __o
> Cell: 617-799-9049
> ... -\<,
> Desk: 617-664-4501 ...
> (_)/(_) ..
> +++++++++++++++++++++++++++++++++++++
>
>
> |---------+------------------------------>
> | | David Cruz |
> | |
> | | com> |
> | | Sent by: |
> | | pgsql-php-owner@pos|
> | | tgresql.org |
> | | |
> | | |
> | | 06/04/2004 01:13 AM|
> | | |
> |---------+------------------------------>
>
>
>----------------------------------------------------------- ------------------------------------------------------------ -------|
> |
>
> |
> | To: pgsql-php@postgresql.org
>
> |
> | cc:
>
> |
> | Subject: [PHP] Hi!, and a Question
>
> |
>
>
>----------------------------------------------------------- ------------------------------------------------------------ -------|
>
>
>
>
> Hello to everybody!
>
> I'm David from Colombia.
>
> I'm learning Postgresql and using PHP. And I'm
> trying
> to connect from my php web page to PostgreSQL, I use
> this function:
>
> $connection = pg_connect("host=gatuno port=5432
> dbname=cdtaller4_3");
>
> and when I look it on the browser it shows:
>
> Fatal error: Call to undefined function:
> pg_connect()
> in /var/www/index2.php on line 8
>
> - I have PostgreSQL 7.4 , Apache is working well,
> and
> all other php scripts too. I'm using knoppix and I
> looked at the KPackage and I have php4-pgsql
> installed.
>
> Does somebody know what could be happening?
>
> thanks!
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends. Fun. Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose
> an index scan if your
> joining column's datatypes do not match
>
>
>
>
>
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Re: Hi!, and a Question
am 08.06.2004 14:20:35 von Frank Bax
Check your apache log to see if error messages are being logged there.
I'll make a guess anyway. With a connect statement like:
$db = pg_connect("dbname=cdtaller4_3");
You should also have user=xxxxx inside the quotes.
You may or may not have more success by adding host=localhost.
Frank
At 02:17 AM 6/8/04, David Cruz wrote:
>Hi!, about this, I'm using it local, in the same
>server is postgresql and the database and the apache
>web server too. I have downloaded the php-pgsql again
>and install it again, it was an rpm and i have knoppix
>(debian), so I did it with #alien -i, I have this in
>my php.ini
>
>------
>;;;;;;;;;;;;;;;;;;;;;;
>; Dynamic Extensions ;
>;;;;;;;;;;;;;;;;;;;;;;
>;
>; If you wish to have an extension loaded
>automatically, use the following
>; syntax:
>;
>; extension=modulename.extension
>;
>; For example, on Windows:
>;
>; extension=msql.dll
>;
>; ... or under UNIX:
>;
>; extension=msql.so
>;
>; Note that it should be the name of the module only;
>no directory information
>; needs to go here. Specify the location of the
>extension with the
>; extension_dir directive above.
>extension=pgsql.so
>
>------
>
>I have pgsql.so in /usr/lib/php4/20020429 which is the
>place where phpinfo(); says it's searching for
>extensions
>
>
>-------
>and my /etc/postgresql/pg_hba.conf says:
>
>#
># TYPE DATABASE USER IP-ADDRESS
>IP-MASK METHOD
># Database administrative login by UNIX sockets
>local all all
> trust
>#
># All other connections by UNIX sockets
>local all all
> trust
>#
># All IPv4 connections from localhost
>host all all 127.0.0.1
>255.255.255.0 trust
>#
># All IPv6 localhost connections
>host all all ::1
>ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust
>host all all ::ffff:127.0.0.1/128
> trust
>#
># reject all other connection attempts
>localhost all all 192.168.1.6
> 255.255.255.0 trust
>
>-------
>and the phpinfo page shows:
>
>pgsql
>PostgreSQL Support enabled
>Active Persistent Links 0
>Active Links 0
>
>Directive Local Value Master Value
>pgsql.allow_persistent On On
>pgsql.auto_reset_persistent Off Off
>pgsql.max_links Unlimited Unlimited
>pgsql.max_persistent Unlimited Unlimited
>
>-----
>I don't know what am I doing but it doesn't work, when
>I execute the php web page:
>
>
>empleados"; $result = pg_exec($db, $query); if (!$result) { printf
>("ERROR"); $errormessage = pg_errormessage($db); echo $errormessage; exit;
>} ?> a index3
>It doesn't shows any error or something it stays on
>the same page it was, and do nothing...
>
>Thanks...if somebody knows another configuration I'm
>forgetting.. (PHP 4, Apache, PostgreSQL 7.4.2, Knoppix
>3.4)
>
>thanks!
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org