title: Call a C program from php and read program output
body: <p>Could some one explain me how to run a C program from a php script and store console output of the C program to a php variable?</p>
  
  <p>My program prints an integer value on the console using C printf() function. I want to read this value and store it in a php variable.<br />
  I am using linux. I tried exec but it doesn't display the variable value once echoed to the page</p>
  
  <p>This the code snippet I am using.</p>
  
  <pre><code>exec("Release/matchface image1.jpg image2.jpg", $output);
  while( list(,$row) = each($output) ) {
    echo $row. "&lt;br /&gt;";
  } 
  </code></pre>