You are here: Re: Running a system command from php « PHP Programming Language « IT news, forums, messages
Re: Running a system command from php

Posted by Peter van Schie on 09/09/05 11:33

jsw_nz wrote:
> Helo, my first post here....
>
> I am trying to run an agent application that converts and imports two
> tables from MS Access into mySql.
> (Intelligent Converters - Access2mySql)
> I have run similar scripts to do mysql dumps using the system function.
> Not sure if the paths included in the parameters are correct:
>
> <?php
> function import_data() {
> $sourceFile = "C:\Program Files\Intelligent converters\myAccessDB.mdb";
> $tableFile = "C:\Program Files\Intelligent Converters\whichTables.txt";
> system("/Program Files/Intelligent Converters/A2SAGENT.EXE
> --dest=st_staff --src=$sourceFile --tab_file=$tableFile --mode=1");
> }
> import_data();
> ?>
>
> This syntax works fine in command line prompt, but somehow it is not
> working when called from php. I have tried two versionn of this (one
> using user/pass - not shown) and the one above.
>
> Any pointers on running this, and getting results.
>
> Cheers,
> John
>

Hi John,

It might have something to do with user-rights, because you execute the
command as the webserver user when you call the script from a webbrowser.
Try to debug it by passing in the second optional parameter to the
system command, which is a reference variable to which the system
command will write the output of the command.

I.e.

system("/Program Files/Intelligent Converters/A2SAGENT.EXE
--dest=st_staff --src=$sourceFile --tab_file=$tableFile --mode=1",
$strOutput);
var_dump($strOutput);

Peter.
--
http://www.phpforums.nl

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация