ssh_exec, isn't working.
#1

I'm creating a panel for my free-hosting plan and I would just like to know; what's the problem with this?

ssh2_exec($connection, 'cd /home/igetty/samp/');
sleep(1);
ssh2_exec($connection,'screen ./samp03svr');

If anybody can help, thank you so much!
Reply
#2

http://php.net/manual/en/function.ssh2-exec.php
http://php.net/manual/en/function.sleep.php

I don't see anything wrong with those. Please explain your problem better.

EDIT: (OFFTOPIC) Check your PMs.

EDIT 2: Debug this.

PHP код:
$sshCmd "cd /home/igetty/samp/";
$sshCmd2 "screen ./samp03svr";
echo(
"Output for command $sshCmd:<br><samp>");
$stdout_stream ssh2_exec($connection$sshCmd); //Execute the command and collect the raw IO stream.
$stderr_stream ssh2_fetch_stream($stdout_streamSSH2_STREAM_STDERR); //Fetch the error stream!
while($line fgets($stderr_stream)) { flush(); echo $line."<br>"; } //Read the lines and print them synchronously!
echo("</samp><br>Output for command $sshCmd2:<br><samp>");
$stdout_stream ssh2_exec($connection$sshCmd2); //Execute the command and collect the raw IO stream.
$stderr_stream ssh2_fetch_stream($stdout_streamSSH2_STREAM_STDERR); //Fetch the error stream!
while($line fgets($stderr_stream)) { flush(); echo $line."<br>"; } //Read the lines and print them synchronously!
echo("</samp><br>END OUTPUT"); 
Reply
#3

Quote:
Originally Posted by Schurman
Посмотреть сообщение
http://php.net/manual/en/function.ssh2-exec.php
http://php.net/manual/en/function.sleep.php

I don't see anything wrong with those. Please explain your problem better.

EDIT: (OFFTOPIC) Check your PMs.

EDIT 2: Debug this.

PHP код:
$sshCmd "cd /home/igetty/samp/";
$sshCmd2 "screen ./samp03svr";
echo(
"Output for command $sshCmd:<br><samp>");
$stdout_stream ssh2_exec($connection$sshCmd); //Execute the command and collect the raw IO stream.
$stderr_stream ssh2_fetch_stream($stdout_streamSSH2_STREAM_STDERR); //Fetch the error stream!
while($line fgets($stderr_stream)) { flush(); echo $line."<br>"; } //Read the lines and print them synchronously!
echo("</samp><br>Output for command $sshCmd2:<br><samp>");
$stdout_stream ssh2_exec($connection$sshCmd2); //Execute the command and collect the raw IO stream.
$stderr_stream ssh2_fetch_stream($stdout_streamSSH2_STREAM_STDERR); //Fetch the error stream!
while($line fgets($stderr_stream)) { flush(); echo $line."<br>"; } //Read the lines and print them synchronously!
echo("</samp><br>END OUTPUT"); 
Just did mate!

Come on the TeamSpeak buddy, we'll talk there.

Thanks for the help m'dear! <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)