title: php exec not getting whole output
body: <p>First of all: I read a lot of answers here for similar questions; but nothing helped.</p>
  
  <p>My problem: I have a <code>php</code> file, where I execute a <code>python</code> file. The python file reads sensor values (that takes some time) and prints these values. Then, I want to echo these values in my php file.</p>
  
  <p>My php file:</p>
  
  <pre><code>&lt;?php
         $var1 =  shell_exec('bash -c "&gt; /var/www/html/log.txt"');
         exec('bash -c "python /var/www/html/readTempAndHumSensor.py"',$output);
         echo count($output);
   ?&gt;
  </code></pre>
  
  <p>My python file:</p>
  
  <pre><code>#!/usr/bin/env python
  import Adafruit_DHT
  
  print "test"
  sensor = Adafruit_DHT.DHT22
  gpio = 10
  # read sensor values (takes aprox. 2s)
  humidity, temperature = Adafruit_DHT.read_retry(sensor, gpio)
  # Output
  print int(temperature*10)
  print int(humidity*10)
  </code></pre>
  
  <p>In <code>$output</code>, <em>test</em> is stored but not the other values. Note: it takes about 2s to read the sensor data</p>