1

I do not know the inner workings of php exec() but I like to know if it create processes or threads for execution of external command.

  • You might take a look at the source code http://lxr.php.net – HamZa Dec 09 '14 at 11:56
  • from the PHP man page it seems like at least on some operating systems it's a process, but of course this is implementation-specific. Can you say which OS you are interested in? – RobP Dec 09 '14 at 11:58
  • Ah, [this](http://lxr.php.net/xref/PHP_5_5/ext/standard/exec.c#82) indicates that it creates a new process – HamZa Dec 09 '14 at 11:59

2 Answers2

2

When you call exec php does not create a thread, it creats a new child process. more information here PHP exec() performance

Community
  • 1
  • 1
styopdev
  • 2,604
  • 4
  • 34
  • 55
0

It has to be a process. You can't launch a new shell in a thread. Threads are delineations of a single process: you cannot start a new program without creating a new process.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055