title: php script to access remote linux server and execute bash script
body: <p>I am trying to do the following. </p>
  
  <p>Have php execute shell commands on our remote servers. This because i would like to be able to install scripts through bash So php is going to execute the bash scripts on the remote server. </p>
  
  <p>The issue is the can't connect to the remote server for some reason. I have tried several way to do this and i have to do with the root and password. Later i can look at encrypting them or something like that, but i can't use a ssh key so that is not going to work. I am pretty new to php part of it so i need some help figuring out hot to connect to remote servers. </p>
  
  <p>the code i am trying right now is </p>
  
  <pre><code>  $ip = '37.130.000.00'; 
  $user = 'admin'; 
  $pass = 'xxxxxxxxx'; 
  
  $connection = ssh2_connect($ip); 
  ssh2_auth_password($connection,$user,$pass); 
  $shell = ssh2_shell($connection,"uptime");
  
  
   echo $shell;
  </code></pre>
  
  <p>For some reason this code is giving me the following error </p>
  
  <p>Fatal error: Call to undefined function ssh2_connect() in</p>
  
  <p>How can i make this work or what else should i do to properly connect to the remote servers and this all should be very flexible as we are talking around 100 server who should be able to connect this way. </p>
  
  <p>Thanks for any input. </p>