Re: how to execute Exe file in system

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

 




Negin Nickparsa <nickparsa@xxxxxxxxx> hat am 17. Februar 2012 um 12:26
geschrieben:

> if(system('gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> it shows me Error

system() Returns the last line of the command output on success, and FALSE
on failure.

So, lets assume your gams program does not fail but prints nothing, the
output is empty.
By simply checking

if (system(...))

you will get echo 'Error'; even if everything is fine, but nothing is
print. Try checking on FALSE

if (($out = system(...)) !== FALSE)
{
  print('Not error');
  printf('Output is "%s"', $out);
}
else
{
  print('Error');
}


Besides: I would prefer setting the complete path to your exe-file.

if (system('C:\\PATH\\TO\\MY\\gams.exe trnsport_php.gms'))

-- 
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