Re: db dump from php - Mailing list pgsql-novice

From jody
Subject Re: db dump from php
Date
Msg-id CAKbzMGfYy4amdjKwdm5Xc16qzrh-GbKG=UWhxJBKwmAH=UOseg@mail.gmail.com
Whole thread Raw
In response to Re: db dump from php  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hi
 thanks to your suggestions i was able to solve the problem:

the socket existed, and it has global permissions:

>  jody@raven ~/progs/magnus2 $ ls -l /run/postgresql/.s.PGSQL.5432
>  srwxrwxrwx 1 postgres postgres 0 Jan  7 20:35 /run/postgresql/.s.PGSQL.5432

but the directory upstairs only allows postgres:

> jody@raven ~/progs/magnus2 $ ls -ld /run/postgresql
> drwxrwx--- 2 postgres postgres 80 Jan  7 20:35 /run/postgresql

i now added the user 'apache' to the group 'postgres' and got one step further:
the connection can be made, but now there is a password problem:

> pg_dump: [archiver (db)] connection to database "magnus2" failed: fe_sendauth: no password supplied

I checked again - i have for some reason used a wrong environment
variable for the password:
it should be PGPASSWORD and not PG_PASSWORD

I changed this and now the dump is correctly done and saved.

Thanks again
  Jody


On Mon, Jan 7, 2013 at 8:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> jody <jody.xha@gmail.com> writes:
>> When i call the php script from the command line, the dump i made.
>
>> When i call it from apache, i get the output
>
>>  pg_dump: [archiver (db)] connection to database "magnus2" failed:
>> could not connect to server: Permission denied Is the server running
>> locally and accepting connections on Unix domain socket
>> "/run/postgresql/.s.PGSQL.5432"?
>
> Does the apache user have permissions to access that socket file?  What
> about the directories containing it?
>
>                         regards, tom lane


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: db dump from php
Next
From: HideMe
Date:
Subject: Does psql evaluate OR conditions in order?