views:

13

answers:

1

Hello,

I am wondering how to start a screen session from PHP, I have tried with shell_exec(), system() and passthru(), but no avail.

I have gotten the screen session started for the execution time of the script, but after it has finished loading, it kills the screen session it just created. (By starting a screen session and executing 'screen -list' in the same script)

Any ideas?

Thanks!

+1  A: 

you'll want to bg(background) and disown the process because *nix uses a process tree such that if the parent of a process terminates all of its children terminate too unless the parent disowns the child.

depending on your shell, appending an & to the end of the command line you execute should be sufficient to do this for you.

Normally you open screen in a terminal window (and i believe screen has builtin commands to background and disown itself) so this wouldn't matter

tobyodavies