0

I have a PHP script in which I am trying to create a screen on my ssh server with the PHP SSH library phpseclib. This is the function that I am using to try to create the screen:

 function startscreen($ssh, $user)
 {
      $ssh->exec("screen -S ".$user);
 }

And this is how I am calling the function:

startscreen($ssh, $user);

I know I can create screens this way, but it will not work remotely with php. Thanks

neubert
  • 15,947
  • 24
  • 120
  • 212
Runner
  • 115
  • 2
  • 11

1 Answers1

0

I'm not at all familiar with screen but... reading about it on wikipedia makes me wonder if it even makes sense to do it via exec(). Like doing exec('vim') doesn't make a ton of sense because vim expects user input after that and exec() doesn't really provide a mechanism for user input to be provided.

Maybe the read() / write() commands would work better for you? Maybe you'd need to do nohup and & to send it to the background?

neubert
  • 15,947
  • 24
  • 120
  • 212