Skip site navigation (1) Skip section navigation (2)

Re: Can't seem to get Psql and Exec to work together

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: YC Nyon <ycnyon(at)pd(dot)jaring(dot)my>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Can't seem to get Psql and Exec to work together
Date: 2002-11-07 08:27:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-php
On Thu, 2002-11-07 at 05:30, YC Nyon wrote:
> I am trying to run Postgresql's psql using Exec() command.
> The code is below
> <?
>  $convert_sql_2 = "\"C:\postgresql\bin\psql.exe -d Geoprocessing -f
> C:\\postgresql\\bin\\g126.sql";
>  exec($convert_sql_2,$ds);
> ?>
> It didn't insert the data I hope it would. I tested it from the dos command
> line and it works fine.
> also i used
> $convert_sql_2 = "\"C:\postgresql\bin\psql.exe --help";
> passthru($convert_sql_2,$ds);
>  It works, giving me the help options.

I know that if I tried such foolery on Linux it would not let me because
it would be a different user running the psql - one which was not
allowed to access the database.

Presumably on "DOS" the same sort of thing is happening.

Why not use the pgsql module in PHP and run your commands into
PostgreSQL directly anyway?  Doing it the way you suggest here just
seems a recipe for a disaster!

Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St,  Wellington
WEB:         PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201     MOB: +64(21)635-694    OFFICE: +64(4)499-2267
           Survey for nothing with 

In response to

pgsql-php by date

Next:From: Andrew McMillanDate: 2002-11-07 09:42:33
Subject: Re: Spaawn another process
Previous:From: Andrew McMillanDate: 2002-11-06 20:05:08
Subject: Re: Handling timestampz datatype

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group