Jump to content

connecting to database using php


jamest

Recommended Posts

Hey everyone,

I'm having trouble connecting to postgreSQL using PHP.

I'm using postgreSQL 7.4, php 5 and apache HTTP server 2.2.3 on RHEL 4. So far I've managed to get PHP to work with apache but cannot get PHP working with postgreSQL. When I configured PHP I used the option --with-pgsql=shared, and the php.ini file has extension=pgsql.so enabled and the extension_dir set appropriately.

When I set up postgreSQL, I did not use the -i option, but I have changed the postgresql.conf file to enable tcpip_socket connections. Ive also modified the pg_hba.conf file to accept local connections and a number of host connections.

When I run postgreSQL by itself I'm able to access the database and run queries, but if I try from a PHP script I have no luck. The php code is being recognised but it fails when I call pg_connect.

Any help would be great

Thanks

James
Link to comment
Share on other sites

  • 1 month later...
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.