Re: how to execute Exe file in system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try to write full path to executable file and don't forget to bring
double quote to that path. It must because "Program files" contain
space and php think your program is "Program" that contain parameter
"files".

if(system(' "C:\Program Files\GAMS23.7\gams.exe" trnsport_php.gms')
....

On Fri, Feb 17, 2012 at 6:26 PM, Negin Nickparsa <nickparsa@xxxxxxxxx> wrote:
> I have a Gams application<http://interfaces.gams-software.com/doku.php?id=env%3aspawning_gams_from_php>
>  which I want to run it through php code after trying many things finally I
> found that for running in commmand line I should go to C:\Program
> Files\GAMS23.7 run a command in commandline for running the application as
> follows:
>
> gams.exe trnsport_php.gms
>
> the Gams wil be run successfully in commandline now I wanted to run it in
> php I added an alias with this path
>
> C:\Program Files\GAMS23.7
>
> and then I created my php file in there when I want to exacute it with this
> code in php:
>
> if(system('gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> it shows me Error
>
> and again using this one:
>
> if(system('./gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> has printed again Error
>
> I tried exec too but no result I don't know what is wrong here.
>
> I read the manual but I coudn't find what's wrong here
>
> echo system('dir')
>
> will show the files of   C:\Program Files\GAMS23.7



-- 
Duken Marga

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux