title: No screen session found when a screen is definitely running
body: <p>G'day,</p>
  
  <p>I have a detached screen running a game server and I am using a bash script <code> command.sh </code> to send commands to a detached screen.</p>
  
  <p>In a terminal I can use the following command and the server performs the command succesfully:</p>
  
  <pre><code>./command.sh 'any command'
  </code></pre>
  
  <p>However once I use PHP to call the script using:</p>
  
  <pre><code>    &lt;?PHP
          if($_POST) {
              $commandString = $_POST['inputCommand'];
              $output = shell_exec('./command.sh $commandString');
              echo "&lt;pre&gt;$output&lt;/pre&gt;";
              }
      ?&gt;
  </code></pre>
  
  <p>The screen returns the error:</p>
  
  <pre><code>No screen session found.
  </code></pre>
  
  <p>I have tried changing the permissions of the bash script to 777 and also tried putting it in the web root directory.</p>
  
  <p>Does any one have any ideas as to why php cannot run the script but I can run the script in a terminal ?</p>
  
  <hr/>
  
  <p><strong>Additional Requested Info</strong></p>
  
  <p>command.sh</p>
  
  <pre><code> #!/bin/bash
   screen -S "minecraft" -X stuff "$@"$'\015'
  </code></pre>