note 82931 added to function.ssh2-shell
| From: | stefanov at uk dot ibm dot com | Date: | Fri, 02 May 2008 15:26:10 +0000 |
| Subject: | note 82931 added to function.ssh2-shell | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138996@lists.php.net to get a copy of this message | ||
Do not use \n to end the command. Some server will fail to process. Use always the standard for PHP
end of line: PHP_EOL
'suri at suribala dot com"'s example should be modified as follows (also change the
double quotes to single, for better performance):
<?php
$con=ssh2_connect('192.168.0.1', 22);
ssh2_auth_password($con, 'user', 'password');
$shell=ssh2_shell($con, 'xterm');
fwrite( $shell, 'cd /dir_one;'.PHP_EOL);
fwrite( $shell, 'ls -la;'.PHP_EOL);
fwrite( $shell, 'cd /dir_two;'.PHP_EOL);
fwrite( $shell, 'ls -la;'.PHP_EOL);
?>
Cheers,
Pimmy
----
Server IP: 92.48.74.199
Probable Submitter: 195.212.29.92
----
Manual Page -- http://www.php.net/manual/en/function.ssh2-shell.php
Edit -- https://master.php.net/note/edit/82931
Del: integrated -- https://master.php.net/note/delete/82931/integrated
Del: useless -- https://master.php.net/note/delete/82931/useless
Del: bad code -- https://master.php.net/note/delete/82931/bad+code
Del: spam -- https://master.php.net/note/delete/82931/spam
Del: non-english -- https://master.php.net/note/delete/82931/non-english
Del: in docs -- https://master.php.net/note/delete/82931/in+docs
Del: other reasons-- https://master.php.net/note/delete/82931
Reject -- https://master.php.net/note/reject/82931
Search -- https://master.php.net/manage/user-notes.php