php - Get process resource by PID -


i want write web ssh console, , found 2 problems.

what want do. first want execute start.php file have following code.

$process = proc_open('start', array(     0 => array("pipe", "r"),      1 => array("pipe", "w"),      2 => array("pipe", "a") ), $pipes); 

second want run command.php file run command on created process in start.php file , results it.

$pid = 12345; print_r(process_command('ping google.com', $pid)); 

i want access process (cmd) created in past, send command , result.

why problem, if can create new process each command.php execution? because new process new session, if login mysql in past command.php execution, in next executions must login mysql again, because new process not remember logged.

example on windows.

  1. i create new process (cmd) in php, current directory c:\webserv\.

enter image description here

  1. i write cd / command, current directory c:\.

enter image description here

this example, dont want change directory, not problem me.

problem how create 1 process , access in next php file executions - if want remember mysql session example?

  1. i can create process proc_open function.
  2. i can pid get_process_status, how process resource created before current php file executed?

and next question, how write new command created process, if accessing created process in past possible?

i dont want use php extensions. if required in case, each answer me.

if access process created in other php executions not possible, want use while(1) control created process @ begin of php execution - hope not required in case. then hope know, how write new command created cmd process.


if solution question problem, accept answer tell me how send commands cmd.exe process opened shell_exec, , how receive response each command.

proc_open() returns resource type. resources cannot serialized cannot save later. freed @ end of script execution exception of persistent database connections.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -