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
https://forums.phpfreaks.com/topic/27089-connecting-to-database-using-php/
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.