trouble with pg_connect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • umagnum338@netscape.net

    trouble with pg_connect

    Hi,

    I'm having some troubles getting pg_connect() to connect over UNIX
    domain sockets. Something that really confuses me is the error string
    being served up by apache. It says it was unable to connect to
    database xxxx. However, the characters are gibberrish. At first I
    thought that my problem was that I forgot to give the user name also
    (seeing there was no apache user in postgresql). However that wasn't
    it. To make sure though, I added an apache username to the postgresql
    server.

    Currently, my pg_connect looks like this:

    $dbconn = pg_connect("dbn ame=mydb user=andy");


    I have checked the pg_hba.conf file, but that shouldn't be it as I can
    connect via psql over UNIX domain. However, given my current
    predicament, I'd like any and all suggestions.

    Andt

  • Steve

    #2
    Re: trouble with pg_connect

    umagnum338@nets cape.net wrote:[color=blue]
    > Hi,
    >
    > I'm having some troubles getting pg_connect() to connect over UNIX
    > domain sockets. Something that really confuses me is the error string
    > being served up by apache. It says it was unable to connect to
    > database xxxx. However, the characters are gibberrish. At first I
    > thought that my problem was that I forgot to give the user name also
    > (seeing there was no apache user in postgresql). However that wasn't
    > it. To make sure though, I added an apache username to the postgresql
    > server.
    >
    > Currently, my pg_connect looks like this:
    >
    > $dbconn = pg_connect("dbn ame=mydb user=andy");
    >
    >
    > I have checked the pg_hba.conf file, but that shouldn't be it as I can
    > connect via psql over UNIX domain. However, given my current
    > predicament, I'd like any and all suggestions.
    >
    > Andt
    >[/color]
    is postgres support compiled/loaded into your php. Check phpinfo()...

    Steve

    Comment

    • Jerry Sievers

      #3
      Re: trouble with pg_connect

      umagnum338@nets cape.net writes:
      [color=blue]
      > Hi,
      >
      > I'm having some troubles getting pg_connect() to connect over UNIX
      > domain sockets. Something that really confuses me is the error string
      > being served up by apache. It says it was unable to connect to
      > database xxxx. However, the characters are gibberrish. At first I[/color]

      Never had this problem.

      Food for thought; are you still running the same version of Postgres
      that your PHP module was built against?

      --
      -------------------------------------------------------------------------------
      Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
      305 321-1144 (mobile http://www.JerrySievers.com/

      Comment

      • Derek Fountain

        #4
        Re: trouble with pg_connect

        umagnum338@nets cape.net wrote:
        [color=blue]
        > I'm having some troubles getting pg_connect() to connect over UNIX
        > domain sockets. Something that really confuses me is the error string
        > being served up by apache. It says it was unable to connect to
        > database xxxx. However, the characters are gibberrish.[/color]

        The fact that you have gibberish characters in the error string is a red
        herring. I saw that when connecting over TCP/IP using "host=localhost ". I
        took that host parameter out so it used UNIX sockets and it continued to
        give error messages like you're getting. I was as bewildered as you are.

        I never did work it out. PostgreSQL security seems horribly complex. I got
        around the problem by turning the security off. I deleted all the default
        entries from /var/lib/pgsql/data/pg_hba.conf and added this line instead:

        local all all trust

        which at least allowed me to get on with my project. I can't recommend it as
        a sensible solution though. Guys like us need to learn how to do this stuff
        properly!

        --
        The email address used to post is a spam pit. Contact me at
        http://www.derekfountain.org : <a
        href="http://www.derekfounta in.org/">Derek Fountain</a>

        Comment

        Working...