title: shell_exec respond to command
body: <p>I'm trying to execute command on my server via php script. I have cPanel, but I'm access php file via my domain. Script is:</p>
  
  <pre><code>$output = exec('php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations');
  echo "&lt;pre&gt;$output&lt;/pre&gt;";
  </code></pre>
  
  <p>It's working, but output is: <code>Apply the above migrations? (yes|no) [no]:</code></p>
  
  <p>I don't know how to respond to this command. I tried code below but it's not working:</p>
  
  <pre><code>exec("php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrations")
      $handle = fopen ("php://stdin","r");
      exec("yes");
      $line = fgets($handle);
      if(trim($line) != 'yes'){
          echo "ABORTING!\n";
          exit;
      }
      echo "\n";
      echo "Thank you, continuing...\n";
  </code></pre>