LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 12: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, 01: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, 03: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



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 03:22 AM
postgres COPY function needed help vickr1z Linux - Newbie 1 11-08-2004 05:36 AM
php postgres problem Xing Linux - Software 3 03-08-2004 12:22 PM
Error connecting to postgres with pgAdmin koswo Linux - Software 1 02-10-2004 07:45 AM
Connecting a Postgres Database from a Java application Paulo Góes Programming 4 08-23-2003 10:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:00 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
Open Source Consulting | Domain Registration