Re: how to execute Exe file in system

From: Date: Fri, 17 Feb 2012 11:49:55 +0000
Subject: Re: how to execute Exe file in system
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-316658@lists.php.net to get a copy of this message
Negin Nickparsa <nickparsa@gmail.com> 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'))

« previous php.general (#316658) next »