Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/11630-connection-problem/
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]
Link to comment
https://forums.phpfreaks.com/topic/11630-connection-problem/#findComment-43908
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]
Link to comment
https://forums.phpfreaks.com/topic/11630-connection-problem/#findComment-43926
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.