title: PuTTy command in PHP doesn't work, web service to restart Raspberry Pi
body: <p>I am trying to do simple web service in PHP (I use Laravel) to restart and shutdown my raspberry  pi.</p>
  
  <p>I tried in my PHP service call something like this:</p>
  
  <pre><code>exec("putty -ssh pi@192.168.0.12 -pw myPassword -m D:\workspace\CPS\public\ssh\restart.txt");
  </code></pre>
  
  <p>In my <em>restart.txt</em> I have simple command <code>sudo shutdown -r now</code></p>
  
  <p>but when I call my web service in Advanced Rest Client Application (Chrome addon), my request is processing and never ending. In command line this works properly.</p>
  
  <p>I thought that the problem is with running PuTTy directly in PHP and I do some changes and create <code>.bat</code> file with the following content:</p>
  
  <pre><code>echo off
  putty -ssh pi@%1 -pw %2 -m %3
  </code></pre>
  
  <p>I start this batch script like this:</p>
  
  <pre><code>exec("D:\workspace\CPS\public\ssh\restart.bat 192.168.0.12 myPassword D:\workspace\CPS\public\ssh\restart.txt");
  </code></pre>
  
  <p>...but result is the same. I changed my web service to GET method and call service in the browser like page but nothing change.</p>
  
  <p>I haven't any error/exception in log files and in console. I also checked the system log but nothing found.</p>
  
  <p>Am I doing something wrong or missed something? It is possible or there is a better way to achieve this?</p>
  
  <p>Currently I run it on Windows 7 and XAMPP. I will do second version for Linux in future and decide in code which command should I run depends on current environment.</p>
  
  <p><strong>Update</strong>
  I forgot to wrote, all required users have permissions to execute files in my <em>(...)/ssh</em> directory</p>