T
T
toptyg2015-11-28 13:34:59
PHP
toptyg, 2015-11-28 13:34:59

PHP script in a separate thread?

how to see the id of the running application launched via php in windows?
(and linux too) now I do it through
exec('start /B cmd /S /C "'.$command.'"');
tried with
if ( is_resource( $prog = proc_open($runPath, $descriptorspec, $pipes, $startDir, NULL) ) )
{
//Get Parent process Id
$ppid = proc_get_status($prog);
$pid=$ppid['pid'];
but in the second case, the pid does not give out and the process starts crookedly. the launch of the command seems to be happening, but either the process hangs or something else ... the command starts to run, but not to the end.
Those. I would like to receive the pid immediately after the command is launched and before it is executed. So that later you can wait and watch the status of the command.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shahelm, 2015-11-30
@Shahelm

See if it can help you.
symfony.com/doc/current/components/process.html

A
asd111, 2016-02-07
@asd111

You can try another version of php under windows. It often happened to me that some function of one version of php under windows is buggy, but works in another version.
You can try to write in python - it will come out almost line by line.
stackoverflow.com/questions/3761639/how-do-you-get...
stackoverflow.com/questions/6767649/how-to-get-pro...
pythonhosted.org/psutil/#psutil.Process.status
https: //docs.python.org/3/library/multiprocessing.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question