LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   starting gnu screen using php (https://www.linuxquestions.org/questions/programming-9/starting-gnu-screen-using-php-924945/)

h3llkill3r 01-21-2012 05:51 AM

starting gnu screen using php
 
I want to do a script to start an application using screen in php. The command to start the server is "screen ./tserver" in directory "/home/servers/". Anyone knows how I can exec that command using php. Thanks.

lucmove 01-21-2012 03:40 PM

Apparently, you just need to run:

exec (screen ./tserver);

http://php.net/manual/en/function.exec.php

I haven't used PHP for many years, so I had to look it up.

May I give you some advice? When I used PHP, a long time ago, I was a computer/linux/programming newbie and didn't know any better. PHP was the only language that I knew, so I ventured into "shell scripting" with PHP. It was very good practice, but I eventually realized that it's hardly a good idea. There are many languages a lot more suitable to such tasks.

Happy coding!

h3llkill3r 01-22-2012 10:01 AM

so to start an application I use screen -d -m ./tserver and I made exec('screen -d -m ./tserver'); and tried with shell_exec too but it isn't working. When I replace screen -d -m ./tserver with exec(mkdir ('folder'));, it works.


All times are GMT -5. The time now is 04:17 PM.