pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedCan't seem to get Psql and Exec to work together
3+ messages / 3 participants
[nested] [flat]
* Can't seem to get Psql and Exec to work together
@ 2002-11-06 16:30 YC Nyon <ycnyon@pd.jaring.my>
0 siblings, 2 replies; 3+ messages in thread
From: YC Nyon @ 2002-11-06 16:30 UTC (permalink / raw)
To: pgsql-php
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.
Nyon
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Can't seem to get Psql and Exec to work together
@ 2002-11-07 08:27 Andrew McMillan <andrew@catalyst.net.nz>
parent: YC Nyon <ycnyon@pd.jaring.my>
1 sibling, 0 replies; 3+ messages in thread
From: Andrew McMillan @ 2002-11-07 08:27 UTC (permalink / raw)
To: YC Nyon <ycnyon@pd.jaring.my>; +Cc: 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!
Regards,
Andrew.
--
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ 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 http://survey.net.nz/
---------------------------------------------------------------------
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Can't seem to get Psql and Exec to work together
@ 2002-11-07 16:23 scott.marlowe <scott.marlowe@ihs.com>
parent: YC Nyon <ycnyon@pd.jaring.my>
1 sibling, 0 replies; 3+ messages in thread
From: scott.marlowe @ 2002-11-07 16:23 UTC (permalink / raw)
To: YC Nyon <ycnyon@pd.jaring.my>; +Cc: pgsql-php
You probably need to adda -U switch to tell postgresql who you are trying
to connect as. It's likely that psql is passing the current user name
that your web server is running as and postgresql doesn't know who that
is.
psql.exe -U username -d Geoprocessing -f filename.sql
should work.
On Thu, 7 Nov 2002, 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.
>
> Nyon
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-11-07 16:23 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-06 16:30 Can't seem to get Psql and Exec to work together YC Nyon <ycnyon@pd.jaring.my>
2002-11-07 08:27 ` Andrew McMillan <andrew@catalyst.net.nz>
2002-11-07 16:23 ` scott.marlowe <scott.marlowe@ihs.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox