title: Using exec() in PHP: Passing arguments
body: <p>For testing purposes, let's say input.PHP looks like this</p>
  
  <pre><code>&lt;?php
  {
  $TO = "joe@net.net";
  $FROM = "bob@net.net";
  $SUB = "Yadda";
  $BODY = "This is a test";
  exec("/usr/bin/php /xxx.yyy.net/TESTS/sendit.PHP $TO $SUB $BODY $FROM &gt; /dev/null &amp;");
  echo "DONE";
  }
  ?&gt;
  </code></pre>
  
  <p>And the sendit.PHP which is called by exec() looks like this</p>
  
  <pre><code>&lt;?php
  $to      = $argv[1];
  $subject = $argv[2];
  $message = $argv[3];
  $headers = 'From: '.$argv[4]. "\r\n" .
  'Reply-To: '.$argv[4]. "\r\n" .
  'X-Mailer: PHP/' . phpversion();
  
  mail($to, $subject, $message, $headers);
  ?&gt;
  </code></pre>
  
  <p>When I open input.PHP in my browser, I get the echo DONE message, but the test email is not sent. What's wrong with my code? Thank You.</p>