title: Inappropriate ioctl for device
body: <p>I'm trying to execute SSH commands through a PHP application.</p>
  
  <p>Through the PHP application, I type "./SSDownload.sh".
  Through my terminal SSH, I type "./SSDownload.sh".</p>
  
  <p><strong>SSDownload.sh contains:</strong></p>
  
  <pre><code>cd /var/www/html/dev/media/mp3/$1
  spotify-to-mp3 songs.txt
  </code></pre>
  
  <p><strong>Through my terminal SSH, I get this response:</strong></p>
  
  <pre><code>Resolving "fancy iggy azalea"
  Searching "fancy iggy azalea" on Grooveshark
  "Iggy Azalea - Fancy (feat. Charli XCX)" will be downloaded
  
  Downloading tracks...
  [1/1] Iggy Azalea - Fancy (feat. Charli  100% [==================================] Time: 00:00:01
  Download complete
  </code></pre>
  
  <p>The file downloads successfully, and places the files in the correct directory.</p>
  
  <p>I tried the same with PHP using the following code:</p>
  
  <pre><code>include('Net/SSH2.php');
  $ssh = new Net_SSH2('iphere');
  if (!$ssh-&gt;login('root', 'password')) {
  exit('Login Failed');
  }
  
  echo "1 : " . $ssh-&gt;exec('./SSDownload.sh ' . $_GET['player']) . "&lt;br /&gt;";
  </code></pre>
  
  <p><em>Output:</em></p>
  
  <pre class="lang-none prettyprint-override"><code>Resolving "fancy iggy azalea" Searching "fancy iggy azalea" on Grooveshark "Iggy Azalea - Fancy (feat. Charli XCX)" will be downloaded Downloading tracks... [0;31;49mInappropriate ioctl for device[0m [0;32;49mDownload complete[0m
  </code></pre>
  
  <p>The file does not download successfully, and does not place the files in the correct directory.</p>
  
  <p>I'd like to bring your attention to "<strong>Inappropriate ioctl for device</strong>", whatever it means.</p>
  
  <p>Why are the responses different? How can I go about fixing it?</p>