Home » Php » Are PHP workers the same as child processes?

Are PHP workers the same as child processes?

Posted by: admin February 25, 2020 Leave a comment

Questions:

I know it’s a noobish question?

Are they the same?
AFAK workers are for Apache and child processes are for PHP-FPM?

Thanks in advance,

How to&Answers:

They are both child processes forked from a parent process, yes. The difference between mod_php and something like PHP-FPM is that mod_php embeds itself as a shared object inside of the apache httpd child worker processes and thus those processes serve as both a web serer process as well as a php process. PHP-FPM, on the other hand, operates outside of the web server as its own Fork-Process-Manager and only communicates with the web server over FastCGI. These are both considered prefork-mpms, however. Also, you can still use FastCGI in apache httpd. So that the child workers are not a part of the web server workers. So this isn’t exclusive to nginx.

Here’s a visual of how the two prefork styles might look:

Using PHP-FPM and Nginx

nginx

Using mod_php and Apache httpd

apache