title: Run Python script from Laravel Controller
body: <p>I want to run the python script from laravel. I'm using the PHP exec function to execute my command, but I'm not successful yet. There's a button in my view, on which I want to run the script.
  Here's the code for button:</p>
  
  <pre><code>{{Form::open(array('url' =&gt; 'run_script','method' =&gt; 'get'))}}
              &lt;button class="btn btn-primary"&gt;Run script&lt;/button&gt;
  {{Form::close()}}
  </code></pre>
  
  <p>Route:</p>
  
  <pre><code>Route::get('run_script',nameOfController@funcName);
  </code></pre>
  
  <p>In Controller:</p>
  
  <pre><code>exec('/usr/bin/python /path/to/folders/where/I/have/script/name_of_script.py' , $output, $return);
  
          if (!$return) 
          {
              throw \Exception('Error running script '.__FILE__);
              echo "python script run Successfully";
  
          } 
  
          else {
          echo "Failed :( &lt;/br&gt;";
          }
          var_dump($output);
  </code></pre>
  
  <p>The vardump of $output gives me empty array with Failed message. 
  I'm not sure either I'm doing it in a right way or not. I'm confused that either I should use "Get" method to run the script or not. </p>
  
  <p>P.s please don't get upset with me I'm learning python and laravel, so my apologies If I'm doing it wrong all the way. </p>