Re: exec() and passthru()

From: Date: Thu, 19 Jun 2003 18:55:36 +0000
Subject: Re: exec() and passthru()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-152216@lists.php.net to get a copy of this message
Still no out put here's my script test.php: $output = shell_exec("/var/www/htdocs/vertex_test/a.out"); echo $output; tried "" and ''. Both test.php and a.out are in same directory and both have 777 perms. also tried $output = shell_exec("./a.out"); ************************************************* In that case what you want is shell_exec(): $output = shell_exec('/path/to/a.out'); // note the whole command line has // to be enclosed in '' or "". echo $output; On Thu, 2003-06-19 at 12:56, Mignon Hunter wrote: > Jason, > > I'm only subscribed to digest and found your reply in archives and > couldnt figure out how to reply :{ > > Anyway, right now I'm just trying to get something to work. The c exe > is as follows: > ****************************** > #include <stdio.h> > #define NAME "Mignon" > int main(void) > { > > int q; > > q = 5; > printf("Hello, %s,%d \n", NAME,q); > return 0; > } > ********************************* > > I'm trying to return the "Hello, Mignon, 5" which is what's outputted on > the command line. > > After I get this to work, I'll be needing it to execute a complex > function in c, and bring variables back to my php shopping cart. > > Here's my test.php: > <? > error_reporting (E_ALL); > error_reporting (E_ERROR | E_WARNING | E_PARSE); > > echo "Here it comes:"; > > /*$var1 = exec(a.out); > echo $var1;//produces:Here it comes: > //tried > "a.out"'a.out'"./a.out"'./a.out' > //./a.out > */ > //******************************************* > > /*$var = passthru(a.out, $ret); > echo $var;//produces:(nothing) > echo $ret;//produces: 127 > */ > //********************************** > > /*$var2 = system(a.out); > echo $var2; //produces:(nothing) > */ > //****************************** > > /*$var6 = "./a.out"; > $var7 = exec($var6, $var_array[], $ret_var); > echo $var7;//produces:(nothing) > echo $var_array[];//produces:Array > echo $ret_var;//produces:127 > echo $var6;//produces:(nothing) > */ > > //******************************************* > > /*$var3 = exec(/var/www/htdocs/vertex_test/a.out, $var_array[], > $ret_var); > echo $var3;//produces:Here it comes > echo $ret_var; > echo $var_array[0]; > */ > //**************************************** > > passthru("/var/www/htdocs/vertex_test/a.out", $res); > echo $res; > > ?> -- Mignon Hunter Web Master and Developer Toshiba International 713.466.0277 x 3461

« previous php.general (#152216) next »