how to execute Exe file in system
| From: | Negin Nickparsa | Date: | Fri, 17 Feb 2012 11:26:47 +0000 |
| Subject: | how to execute Exe file in system | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-316655@lists.php.net to get a copy of this message | ||
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