exec() and passthru()
| From: | Mignon Hunter | Date: | Thu, 19 Jun 2003 17:56:14 +0000 |
| Subject: | exec() and passthru() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152202@lists.php.net to get a copy of this message | ||
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