Jump to content


Photo

connection problem


  • Please log in to reply
3 replies to this topic

#1 pmilosev

pmilosev
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 June 2006 - 01:30 AM

Hi
I've installed Postgre for first time and tried to connect php

<?php
echo "1";
pg_connect("host=localhost ...");
echo "2";
?>

I was expecting an error on the connection string maybe
but all I got was

1

... I tried several times with different connection strings ... and aways
php stoped on pg_connect

help ?

thx


#2 neylitalo

neylitalo
  • Staff Alumni
  • Advanced Member
  • 1,854 posts
  • LocationMichigan, USA

Posted 10 June 2006 - 01:58 AM

Good choice! I love Postgres - it's much more powerful than MySQL.

May I suggest the ADOdb library? It's a PHP library that gives you an ultra-easy way to interface with nearly any database system on the planet, and it's very powerful. [a href=\"http://adodb.sourceforge.net\" target=\"_blank\"]http://adodb.sourceforge.net[/a].

Regardless of your decision to use ADOdb or not, you'll want to check these things:
  • Make sure that Postgres is running. If you're running Windows, it's probably in your Services list, and if you're running *nix, then you can run "ps ax | grep postgres" to see if there are any postgres processes.
  • Make sure that your PHP has postgres support enabled. In Windows, you need to uncomment the appropriate line in php.ini - in Unix, you need to compile php --with-pgsql.
  • And make sure your connect string is correct for your server, if the above two are taken care of.

http://nealylitalo.net - My personal website, and home of The Netizen's Journal.

#3 eawf

eawf
  • Members
  • PipPip
  • Member
  • 10 posts
  • LocationTacoma, WA

Posted 10 June 2006 - 05:08 AM

Check your Error Logs for the actual PHP error.

Also, instead of writing the connect code, use Justin Vincent's ez_SQL database wrapper. Makes database interactions rediculously simple.

[!--quoteo(post=382122:date=Jun 10 2006, 01:30 AM:name=PC-SandMan^^)--][div class=\'quotetop\']QUOTE(PC-SandMan^^ @ Jun 10 2006, 01:30 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi
I've installed Postgre for first time and tried to connect php

<?php
echo "1";
pg_connect("host=localhost ...");
echo "2";
?>

I was expecting an error on the connection string maybe
but all I got was

1

... I tried several times with different connection strings ... and aways
php stoped on pg_connect

help ?

thx
[/quote]


#4 pmilosev

pmilosev
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 June 2006 - 04:22 PM

thx a lot
dummy mistake .... I didn't include postgreSQL ext in my php.ini

thx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users