Voting

: two minus zero?
(Example: nine)

The Note You're Voting On

gakksimian at yahoo dot com
19 years ago
Executing remote Windows commands...
After some hair pulling, I thought I'd suggest a couple things that might help others:

1. Use 'ssh2_fetch_stream' to open a stderr stream according to the manual.
2. Windows shell commands require 'cmd /C [command]' to execute. (I had forgotten this)

<?php
// code fragment
$stdout_stream = ssh2_exec($connection, 'cmd /C dir');
$stderr_stream = ssh2_fetch_stream($stdout_stream, SSH2_STREAM_STDERR);
?>

I didn't realize the need for the 'cmd /C' until I saw the stderr response 'dir: not found'.

<< Back to user notes page

To Top