phpssh2-exec

SSH2 and PHP not working 'Terminal'


Whenever I try and execute

if (!($stream = ssh2_exec($con, "cd $dir; screen -S creative java -Xmx500M -Xms500M -jar spigot.jar" ))) {

it keeps returning with 'Must be connected to a terminal.' which I can't seem to get around. How do I get around/fix this?


Solution

  • Test this : You should pass a pty emulation name ("vt102", "ansi", etc...) if you want to emulate a pty, or NULL if you don't.

    Passing false will convert false to a string, and will allocate a "" terminal.

    cf. http://php.net/manual/fr/function.ssh2-exec.php