Vex Star

Vex Star

Computers and Programming

Vex Star RSS Feed
 
 
 
 

Posts tagged exec.

SSH / PHP help

Okay here’s what I’m doing – I’m trying to get this php page to connect to a Unix box and (an ESX box)
and execute some commands.
It connects fine, and even executes SOME commands just fine.
Heres the code:

<?php

$doit = "vim-cmd vmsvc/getallvms" ;
$connection = ssh2_connect(‘192.168.10.9′, 22);
ssh2_auth_password($connection, ‘root’, ‘mysecret’);

$cmd = shell_exec($doit)

if ($cmd){echo(‘pass <br><br>’);}
else{echo(‘fail<br><br>’);}
echo ($cmd);

?>

Now that if [...]