Обсуждение: pgsql + php3 expert needed. Can you solve this problem?

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

pgsql + php3 expert needed. Can you solve this problem?

От
Robert Chalmers
Дата:
NOTE: For those who never read past the first sentence - please read the whole
message.

On a FreeBSD-2.2 Pentium platform,

I have Apache-1.3.3 with Php-3.0.6 as a compiled in module, and
Postgresql-6.4.1.

Prior to this, I had Apache with phpfi, an earlier version of php3, and
Postgresql-6.1, which worked fine.

The postgres's pg_hba.conf file remains the same. The php3.ini file is
operational and fine.

Apache delivers php3 documents with no problem.
postgresql passes all its regression tests, and also 'works' fine.

However,
Since I have updated, either php3, or pgsql, is refusing a connection from the
php3 engine to the database.

This is the Error message delivered to the Browser, from the document I called
"begin.php3", which is at;
http://www.chalmers.com.au/~robert/begin.php3

Warning: Unable to connect to PostgresSQL server: connectDB() -- unknown
hostname: nanguo in
/usr/home/robert/www/begin.php3 on line 9
Database NOT Connected.


The document could not be simpler. This is it. 14 lines of code.

<html>
<body>
<?php  $database = pg_connect("host=nanguo dbname=ecotourism port=5432");  ?>
<br>
<?php  if ($database):
 echo "Database Connection.";
    else:
 echo "Database NOT Connected.";
 endif;
?>
<br>
</body>
</html>



In short, I now have a completly new, up to date suite of software, that works
perfectly, just won't do the 'connect to database' bit from php3!

The question is: What is telling me that "unknown hostname: nanguo" error. and
what can I do to fix it?



I'd really appreciate a solution to this. I need to be able to talk to the
databases.
Thanks
Robert

--
http://www.chalmers.com.au               Chinese Language Studies.
http://4qir.quantum-radio.net.au                     World Music Radio.
phone:61-7-49440357 - fax:61-7-49512832           icq#11252938.
Courses and Resources and Radio 4QIR.   Working for Whirled Peas.



Re: [PHP3] pgsql + php3 expert needed. Can you solve this problem?

От
"Mr. Poet"
Дата:
add your hostname to you hosts file
and make sure you have search yourdomain.com in your resolv.conf


            --Linux for Profit--
            poet@linuxports.com
              http://www.linuxports.com
              --Power to the Penguin--
On Sun, 27 Dec 1998, Robert Chalmers wrote:

> NOTE: For those who never read past the first sentence - please read the whole
> message.
>
> On a FreeBSD-2.2 Pentium platform,
>
> I have Apache-1.3.3 with Php-3.0.6 as a compiled in module, and
> Postgresql-6.4.1.
>
> Prior to this, I had Apache with phpfi, an earlier version of php3, and
> Postgresql-6.1, which worked fine.
>
> The postgres's pg_hba.conf file remains the same. The php3.ini file is
> operational and fine.
>
> Apache delivers php3 documents with no problem.
> postgresql passes all its regression tests, and also 'works' fine.
>
> However,
> Since I have updated, either php3, or pgsql, is refusing a connection from the
> php3 engine to the database.
>
> This is the Error message delivered to the Browser, from the document I called
> "begin.php3", which is at;
> http://www.chalmers.com.au/~robert/begin.php3
>
> Warning: Unable to connect to PostgresSQL server: connectDB() -- unknown
> hostname: nanguo in
> /usr/home/robert/www/begin.php3 on line 9
> Database NOT Connected.
>
>
> The document could not be simpler. This is it. 14 lines of code.
>
> <html>
> <body>
> <?php  $database = pg_connect("host=nanguo dbname=ecotourism port=5432");  ?>
> <br>
> <?php  if ($database):
>  echo "Database Connection.";
>     else:
>  echo "Database NOT Connected.";
>  endif;
> ?>
> <br>
> </body>
> </html>
>
>
>
> In short, I now have a completly new, up to date suite of software, that works
> perfectly, just won't do the 'connect to database' bit from php3!
>
> The question is: What is telling me that "unknown hostname: nanguo" error. and
> what can I do to fix it?
>
>
>
> I'd really appreciate a solution to this. I need to be able to talk to the
> databases.
> Thanks
> Robert
>
> --
> http://www.chalmers.com.au               Chinese Language Studies.
> http://4qir.quantum-radio.net.au                     World Music Radio.
> phone:61-7-49440357 - fax:61-7-49512832           icq#11252938.
> Courses and Resources and Radio 4QIR.   Working for Whirled Peas.
>
>
>
> --
> PHP 3 Mailing List   http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe@lists.php.net
> To subscribe to the digest list:  php3-digest-subscribe@lists.php.net
> For help: php3-help@lists.php.net  Archive:  http://www.php.net/mailsearch.php3
> List administrator:  zeev@zend.com
>
>
>


Re: [ADMIN] pgsql + php3 expert needed. Can you solve this problem?

От
Terry Mackintosh
Дата:
Hi Robert

On Sun, 27 Dec 1998, Robert Chalmers wrote:

> Since I have updated, either php3, or pgsql, is refusing a connection from the
> php3 engine to the database.
> ....
> <html>
> <body>
> <?php  $database = pg_connect("host=nanguo dbname=ecotourism port=5432");  ?>

I use PHP 3 all the time, and have never seen the above syntax, is that
PHP/FI syntax? so that may be your problem.  Here is how I do it:

if ( !($database = pg_connect("localhost","5432","","","ecotourism")))
{// NOTE the use of 'localhost', if it's all on 1 box, thats all you need.
   echo "Bad connection to database!<p>Sorry<p>.\n";
}
else
{
// Good to go!
}

> <br>
> <?php  if ($database):
>  echo "Database Connection.";
>     else:
>  echo "Database NOT Connected.";
>  endif;
> ?>
> <br>
> </body>
> </html>


Hope that helps
Terry Mackintosh <terry@terrym.com>          http://www.terrym.com
sysadmin/owner  Please! No MIME encoded or HTML mail, unless needed.

Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.4
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!