python - Unable to run SSH through php on XAMPP in Linux -


i'm trying run ssh in python through os.system() being invoked php. works fine when run through cli version of php not running through lamp.

following php code:

<?php $x=shell_exec('python test.py'); ?> 

and below python code (test.py) being invoked php code:

import os os.system("ssh test@127.0.0.1") 

i tried using touch utility through exec() in php, same thing happens.

use phpseclib. using ssh2 extension recommended @ramesh dahiya bad number of reasons elaborated here:

http://phpseclib.sourceforge.net/ssh/compare.html

example of phpseclib being used:

<?php include('net/ssh2.php');  $ssh = new net_ssh2('www.domain.tld'); if (!$ssh->login('username', 'password')) {     exit('login failed'); }  echo $ssh->exec('pwd'); echo $ssh->exec('ls -la'); ?> 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -