title: php exec missing output
body: <p>I am trying to execute the python script for POS tagging through PHP. 
  But its not returning the full output.</p>
  
  <p><strong>Python script:</strong></p>
  
  <pre><code>import nltk
  import sys
  
  text = sys.argv[1]
  
  tokenize_into_words = nltk.word_tokenize(text)
  
  print text
  
  result = nltk.pos_tag(tokenize_into_words)
  
  print result
  
  print "Done!"
  </code></pre>
  
  <p><strong>PHP script</strong></p>
  
  <pre><code>$cmd = 'python /Library/WebServer/Documents/varticle/vcmdpos.py ' . $string2;
  
  $tmp = exec($cmd,$output);
  
  print_r($output);
  </code></pre>
  
  <p><strong>Command:</strong></p>
  
  <p>python /Library/WebServer/Documents/varticle/vcmdpos.py Scientists</p>
  
  <p><strong>Observed Output:</strong></p>
  
  <p>Array ( [0] => Scientists )</p>
  
  <p><strong>Expected Ouput:</strong></p>
  
  <p>Array ( [0] => Scientists [1] => "[('Scientists', 'NNS')]" [2] => "Done!")</p>
  
  <p>When I run the command manually it takens around 5-10 sec to run. [This may be due to the time required to do POS tagging or importing nltk.] </p>
  
  <p>But when run through PHP it immediately returns and output from nltk.pos_tag or print statement after it is not returned. </p>
  
  <p>Am I missing something?</p>