Jump to content

Archived

This topic is now archived and is closed to further replies.

pmilosev

connection problem

Recommended Posts

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

Share this post


Link to post
Share on other sites
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:[list][*]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.[/list]

Share this post


Link to post
Share on other sites
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) [snapback]382122[/snapback][/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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.