title: Calling php from php through exec() gives no result
body: <p>I have a PHP script that creates other PHP files based on user input. Basically, there are files containing language specific constants (<code>define</code>) that can be translated by the user. In order to avoid runtime errors, I want to test newly written files for parse errors (due to "unusual" character sequences). I have read several posts here on SO (like <a href="https://stackoverflow.com/questions/1255230/php-include-files-with-parse-errors">PHP include files with parse errors</a>) and tried a function that uses</p>
  
  <pre><code>$output = exec("php -l $filename");
  </code></pre>
  
  <p>to determine whether a file parses correctly. This works perfectly on my local machine, but at on the provider's machine, the output of calls to <code>exec("php ...")</code> seems to be always empty. I tried a call to <code>ls</code> and it gives me output, leading me to the assumption that PHP is somehow configured to not react to command line invocations or so. Does anyone know a way around this?</p>
  
  <p><strong>EDIT:</strong> I forgot to mention, I had already tried <code>shell_exec</code> and it gives no result, either. In response to sganesh's answer: I had tried that too, sorry I forgot to mention. However, the output (second argument) will always be an empty array, and the return value will always be 127, no matter if the PHP file to test has syntax errors or not.</p>