I want to write a Web SSH console, and I found two problems.
What do I have to do? First I want to execute the start.php file which contains the following code.
Second I want to run the command.php file that runs commands on the process created in the start.php file And get results.
$ pid = 12345; Print_r (process_command ('ping google.com', $ pid)); I just want to use the process created in the past ( cmd ), send it commands and get results.
Why is this problem, if I can make a new process for each command.php execution? Because the new process is a new session, if I log in mysql in the previous command.php execution, then I will have to log in to mysql again in the next hanging, because the new process does not remember That I was logged in.
For example.
- I am creating a new process (
cmd) in PHP, my current directory isc: \ web server \.
- I write the command
, my current directory C: \.
< Strong> This is just an example, I just do not want to change the directory, it is not the problem for me.
The problem is that a process in the next PHP file execution and how to use it - if I should remember the session for example mysql ?
- I can make the process through the
proc_openfunction. - I can get a PID from the
get_process_status, but how was the process processing created before the existing PHP file?
And the next question, how is the past possible to write a new command for the process created?
I do not want to use the PHP extension but if this is needed in this case, then every answer will help me.
If the other PHP execution does not have access to the built-in process, then I want to use the while (1) the process of creation of PHP execution To control - but I hope this is not necessary in this case. Then I hope that anyone will know how to write the new command for the cmd process created.
If the solution to my question is the problem, I will accept the answer which tells me that the cmd.exe process is shell_exec , and how to get feedback for each command.
proc_open () a resource Strong> returns the type. Resources can not be sorted so that you can save it later. They are constantly free with the exception of free database connections at the end of script execution.
No comments:
Post a Comment