ssh - Unable to login with Net_SSH2 in PHP -
i attempting ssh php can not login when include in other file
created ssh.php , place "root/include" directory of server:
include 'net/ssh2.php'; //initialize ssh object $ssh = new net_ssh2('my_linux_address','ssh_port'); //login linux host provided root username , password if (!$ssh->login('username', 'pass')) { exit('login failed'); } echo $ssh->exec("ls -al");
and execute calling browser: http://myserver/include/ssh.php
work fine
created second file: ssh2.php, place "root" directory
ssh2.php file simply:
include 'include/ssh.php';
finally run ssh2.php brower: http://myserver/ssh2.php -> "login failed"
Comments
Post a Comment