-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathREADME
43 lines (38 loc) · 1.01 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
SSH Client Class
v 0.2
Checking:
$ php -m | grep ssh
Installing:
$ sudo apt-get install php5-dev php5-cli php-pear build-essential openssl-dev zlib1g-dev libssh2-1-dev
$ sudo pecl install -f ssh2
$ echo 'extension=ssh2.so' > /etc/php5/conf.d/ssh2.ini
Using:
|
|- Connect:
| __construct([$host = "localhost"[, $login = "root"[, $password = ""[, $port = 22]]]]);
| | $ssh = new ssh('google.com', 'root', 'password'[, $port = 22]);
|
|- Exec command:
|
| | $result = $ssh("ls -la");
| or
| | $array_of_result = $ssh(array("ls -la", "uptime"));
| or
| | $array_of_result = $ssh("ls -la", "uptime");
| or
| | $array_of_result = $ssh(array("echo 1", "echo 2"), "echo 3", array(array("echo 4", "echo 5", "echo 6"), "echo 7"));
|
|- Tunnel:
| | $f = $ssh->tunnel("10.0.0.100", 1234);
|
|- Download:
| | $ssh->download("/remote/file", "/local/file");
|
|- Upload:
| | $ssh->upload("/local/file", "/remote/file"[, $file_mode = 0644]);
|
|- Reconnect:
| | $ssh->reconnect();
|
|- Disconnect is automatic;
Thx 4 using;