LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-11-2004, 01:23 AM   #1
vickr1z
Member
 
Registered: Mar 2004
Location: manila, philippines
Distribution: RH 7.3
Posts: 63

Rep: Reputation: 15
php postgres connecting needed help


goo day to all.

id like to ask if how can i make a php script to connect on remote postgres server.
let say my localhost was 192.19.0.100 and the remote postgres server host was 192.19.0.101.

any idea? thanks again in advance, and more power!

chris
 
Old 11-11-2004, 02:54 AM   #2
iluvatar
Member
 
Registered: Jul 2003
Location: netherlands
Distribution: debian
Posts: 403

Rep: Reputation: 30
first make sure the postgres server is tcp/ip enabled, second make sure php is postgres enabled, then you can use this php code:
Code:
<?php
$connection = pg_connect("host=192.19.0.101 port=5432 dbname=<database name> user=<user> password=<password>");
?>
all arguments are optional, and have default values wich can be set. check the php documentation on postgresql.

greetz,
.-=~ iluvatar ~=-.
 
Old 11-11-2004, 04:13 AM   #3
linux_terror
Member
 
Registered: Aug 2004
Location: Northbrook, Illinois
Distribution: CentOS-5
Posts: 311

Rep: Reputation: 30
just being proactive here--make sure the firewall on the postgres server is allowing connections on port 5432 and if it's behind a router make sure its forwarded.

linux_terror
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
postgres dump needed help. vickr1z Linux - Newbie 3 11-10-2004 04:22 AM
postgres COPY function needed help vickr1z Linux - Newbie 1 11-08-2004 06:36 AM
php postgres problem Xing Linux - Software 3 03-08-2004 01:22 PM
Error connecting to postgres with pgAdmin koswo Linux - Software 1 02-10-2004 08:45 AM
Connecting a Postgres Database from a Java application Paulo Ges Programming 4 08-23-2003 11:08 AM


All times are GMT -5. The time now is 06:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration