pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedConnection problem
4+ messages / 3 participants
[nested] [flat]
* Connection problem
@ 2001-11-24 22:36 Laukó Péter <plauko@freemail.hu>
2001-11-26 14:59 ` Re: Connection problem Dan Wilson <phpPgAdmin@acucore.com>
2001-12-04 14:54 ` Re: Connection problem Ewald Geschwinde <postgres@cybertec.at>
0 siblings, 2 replies; 4+ messages in thread
From: Laukó Péter @ 2001-11-24 22:36 UTC (permalink / raw)
To: pgsql-php
Hi,
I try to connect to a PostgreSQL database from my php script, and get the following error:
Warning: Unable to connect to PostgreSQL server: FATAL 1: Database "www-data" does not exist in the system
catalog. in /home/lao/proj/hajnalcsillag/www/classes/DBConnection.php on line 10
The code is:
<?
class DBConnection
{
var $con_string;
function DBConnection()
{
$con_string = "dbname=hajnalcsillag user=lao password=abc123 host=localhost port=5432";
$ret = pg_connect( $this->con_string );
}
}
?>
I could solve part of the problem by creating a user and database called 'www-data'.
Since I have several sites on the same server, I need more independent db-s, so this solution is not enough.
This seems to be a configuration problem, but I don't know where to turn off this (security?) option.
The versions are:
PHP Version 4.1.0RC1
PostgreSQL 7.1.3
Apache/1.3.22
Debian sid
Could anyone help me please?
Thanks, Peter
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Connection problem
2001-11-24 22:36 Connection problem Laukó Péter <plauko@freemail.hu>
@ 2001-11-26 14:59 ` Dan Wilson <phpPgAdmin@acucore.com>
2001-11-27 02:15 ` Re: Connection problem Dan Wilson <phpPgAdmin@acucore.com>
1 sibling, 1 reply; 4+ messages in thread
From: Dan Wilson @ 2001-11-26 14:59 UTC (permalink / raw)
To: Laukó Péter <plauko@freemail.hu>; pgsql-php
What exactly are you trying to do here?
Depending on what you really want to do here, you need to change your
connection string to fit what you want.
In order to connect to postgres, you must specify a database. If you do not
want to connect to a database immediately, then you can use the default
database (which is usually "template1"). Otherwise, if you don't indicate a
database to which to connect, it will assume you are trying to connect to
the user's database, which by default is the same name as the user. I'm
assuming that your web server is running under the "www-data" user account.
If you explain more in detail what you want to accomplish, we will be able
to help better.
-Dan
: Hi,
: I try to connect to a PostgreSQL database from my php script, and get the
following error:
:
: Warning: Unable to connect to PostgreSQL server: FATAL 1: Database
"www-data" does not exist in the system
: catalog. in /home/lao/proj/hajnalcsillag/www/classes/DBConnection.php on
line 10
:
: The code is:
: <?
:
: class DBConnection
: {
: var $con_string;
:
: function DBConnection()
: {
: $con_string = "dbname=hajnalcsillag user=lao password=abc123
host=localhost port=5432";
: $ret = pg_connect( $this->con_string );
: }
: }
:
: ?>
:
: I could solve part of the problem by creating a user and database called
'www-data'.
: Since I have several sites on the same server, I need more independent
db-s, so this solution is not enough.
: This seems to be a configuration problem, but I don't know where to turn
off this (security?) option.
:
: The versions are:
: PHP Version 4.1.0RC1
: PostgreSQL 7.1.3
: Apache/1.3.22
: Debian sid
:
: Could anyone help me please?
: Thanks, Peter
:
: ---------------------------(end of broadcast)---------------------------
: TIP 5: Have you checked our extensive FAQ?
:
: http://www.postgresql.org/users-lounge/docs/faq.html
:
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Connection problem
2001-11-24 22:36 Connection problem Laukó Péter <plauko@freemail.hu>
2001-11-26 14:59 ` Re: Connection problem Dan Wilson <phpPgAdmin@acucore.com>
@ 2001-11-27 02:15 ` Dan Wilson <phpPgAdmin@acucore.com>
0 siblings, 0 replies; 4+ messages in thread
From: Dan Wilson @ 2001-11-27 02:15 UTC (permalink / raw)
To: Laukó Péter <plauko@freemail.hu>; pgsql-php
I'm sorry, I didn't look at this very closely... just looked at the error
and assumed....
It looks like your problem is actually your variable that you are passing
into the pg_connect. When you are setting up your connection string,
$con_string should be $this->con_string.
It's giving you this error because it's not getting any parameters in
pg_connect.
-Dan
: What exactly are you trying to do here?
:
: Depending on what you really want to do here, you need to change your
: connection string to fit what you want.
:
: In order to connect to postgres, you must specify a database. If you do
not
: want to connect to a database immediately, then you can use the default
: database (which is usually "template1"). Otherwise, if you don't indicate
a
: database to which to connect, it will assume you are trying to connect to
: the user's database, which by default is the same name as the user. I'm
: assuming that your web server is running under the "www-data" user
account.
:
: If you explain more in detail what you want to accomplish, we will be able
: to help better.
:
: -Dan
:
:
: : Hi,
: : I try to connect to a PostgreSQL database from my php script, and get
the
: following error:
: :
: : Warning: Unable to connect to PostgreSQL server: FATAL 1: Database
: "www-data" does not exist in the system
: : catalog. in /home/lao/proj/hajnalcsillag/www/classes/DBConnection.php on
: line 10
: :
: : The code is:
: : <?
: :
: : class DBConnection
: : {
: : var $con_string;
: :
: : function DBConnection()
: : {
: : $con_string = "dbname=hajnalcsillag user=lao password=abc123
: host=localhost port=5432";
: : $ret = pg_connect( $this->con_string );
: : }
: : }
: :
: : ?>
: :
: : I could solve part of the problem by creating a user and database called
: 'www-data'.
: : Since I have several sites on the same server, I need more independent
: db-s, so this solution is not enough.
: : This seems to be a configuration problem, but I don't know where to turn
: off this (security?) option.
: :
: : The versions are:
: : PHP Version 4.1.0RC1
: : PostgreSQL 7.1.3
: : Apache/1.3.22
: : Debian sid
: :
: : Could anyone help me please?
: : Thanks, Peter
: :
: : ---------------------------(end of broadcast)---------------------------
: : TIP 5: Have you checked our extensive FAQ?
: :
: : http://www.postgresql.org/users-lounge/docs/faq.html
: :
:
:
: ---------------------------(end of broadcast)---------------------------
: TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
:
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Connection problem
2001-11-24 22:36 Connection problem Laukó Péter <plauko@freemail.hu>
@ 2001-12-04 14:54 ` Ewald Geschwinde <postgres@cybertec.at>
1 sibling, 0 replies; 4+ messages in thread
From: Ewald Geschwinde @ 2001-12-04 14:54 UTC (permalink / raw)
To: Laukó Péter <plauko@freemail.hu>; +Cc: pgsql-php
>
>
>
>The code is:
><?
>
>class DBConnection
>{
> var $con_string;
>
> function DBConnection()
> {
> $con_string = "dbname=hajnalcsillag user=lao password=abc123 host=localhost port=5432";
> $ret = pg_connect( $this->con_string );
> }
>}
>
>?>
>
it's better to do it so
$this>con_string="dbname.....";
otherwise you run into big trouble
cause
$this->con_string =>GLOBAL
$con_string=>local
PHP is nto so stble with such declarations
(real-tie experience)
Ewald
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-12-04 14:54 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-24 22:36 Connection problem Laukó Péter <plauko@freemail.hu>
2001-11-26 14:59 ` Dan Wilson <phpPgAdmin@acucore.com>
2001-11-27 02:15 ` Dan Wilson <phpPgAdmin@acucore.com>
2001-12-04 14:54 ` Ewald Geschwinde <postgres@cybertec.at>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox