title: sh: 1: ruby: not found when i am executing ruby from browser
body: <p>I am creating a PHP website which have to execute a ruby command from terminal for that i am using :-
  1)</p>
  
  <pre><code>$output = shell_exec('ruby emailConverter.rb 2&gt;&amp;1');
  var_dump($output);
  </code></pre>
  
  <p>This throws the error</p>
  
  <pre><code>string(23) "sh: 1: ruby: not found"
  </code></pre>
  
  <p>or
  2)</p>
  
  <pre><code>exec("ruby emailConverter.rb", $output, $return);
  var_dump($output);
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>AFTER doing this as @psal  suggested</p>
  
  <pre><code>$path = '/home/vishal/.rvm/rubies/ruby-2.1.2/bin/ruby'
  $output = shell_exec($path.' emailConverter.rb 2&gt;&amp;1');
  var_dump($output);
  </code></pre>
  
  <p>getting this error</p>
  
  <pre><code> string(308) "/home/vishal/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require: cannot load such file -- premailer (LoadError)
  from /home/vishal/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require'
  from emailConverter.rb:4:in `&lt;main&gt;'
  </code></pre>
  
  <p>but when i execute this any of the above command(1 and 2) directly from terminal, it works fine...</p>
  
  <p>what is the problem with that?
  Any help?</p>