LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-17-2006, 08:05 AM   #1
NuWeb
Member
 
Registered: Nov 2006
Posts: 55

Rep: Reputation: 15
Getting Apache + PHP + postgres working together


I was able to install Apache, PHP and postgres. They all work on thier own, Apache and PHP even work together but I can't seem to get postgres working with PHP/ When I compiled PHP I used "--with-pgsql=/user/local/pgsql/bin"
Is this correct.?.?

This is what I get when I try to run a program with postgres from the command prompt (this program works on another server):

PHP Warning: Unknown(): Unable to load dynamic library '/usr/lib/php/extensions/mysql.so' - libmysqlclient.so.14: cannot open shared object file: No such file or directory in Unknown on line 0


Why is it looking for mysql when I compiled it with postgres.?

How can I get this working correctly.?
 
Old 12-17-2006, 05:08 PM   #2
NuWeb
Member
 
Registered: Nov 2006
Posts: 55

Original Poster
Rep: Reputation: 15
I figured out how to get around this problem. The php.ini file needed to have the mysql links fixed.

Now...

Apache and seem to work togehter fine. When I try using postgres in php using Apache I get:
Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host localhost and accepting TCP/IP connections on port 5432? in /home/sites
--- and ---
Warning: pg_last_error() [function.pg-last-error]: No PostgreSQL link opened yet in /home/sites/spfx/site_list.html on line 22

How do I know if "localhost" and "TCP/IP connections" are setup correctly and how do I know the server is running on port "5432".?

I know the postgres server is running, I can access the database using "psql".

If I run the php/postgres program from the command prompt it stops as soon as is hits the first "pg_" command. No output, no errors, it just stops.
 
Old 12-18-2006, 10:49 AM   #3
NuWeb
Member
 
Registered: Nov 2006
Posts: 55

Original Poster
Rep: Reputation: 15
More info...

For years on all my servers and all my sites I have used:
$conn = pg_Connect("localhost", "5432", "", "", "$database");

Now that this is the first server I completely loaded it sudden;t doesn't work but if I make a minor change it works:
$conn = pg_Connect("localhost", "5432", "nobody", "", "$database");

This should be sinple but my question is do I need to changes "ALL" my programs that use "pg_Connect" or is there something I so I don't have to change all my programs.

this isn't the where I should be asking this questions but what is the correct usage:
$conn = pg_Connect("localhost", "5432", "", "", "$database");
--- or ---
$conn = pg_Connect("localhost", "5432", "nobody", "", "$database");
 
  


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
Can't Connect to Postgres with PHP... markw8500 Linux - General 1 11-11-2006 04:32 AM
Apache php postgres headaches sandWorm Mandriva 3 10-09-2006 10:51 AM
Apache PHP Postgres works but not together... PeO Linux - Software 1 10-12-2005 08:01 AM
Apache/PHP not working Seventh Linux - Software 1 06-23-2005 05:37 PM
Apache + PHP not working WiWa Linux - Networking 3 10-18-2004 06:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:58 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