Write the server in C language, judge after receiving the request, statically read the file directly and return, dynamically request to fork a child process exec to execute the cgi program, and then the parent process reads the child process result and returns it to the client. How does the cgi program here (that is, the php code) communicate with php?
Is this any different from using FASTCGI to call php-fpm through socket?
You may have some misunderstandings, please refer to this article.
http://www.php-internals.com/...
The http server needs to implement apache's module loading. PHP runs as an apache module. http receives the request and hands the dynamic request to apache's php mod for execution
Http ip three-way handshake
unix domain socket ?
You can refer to Apache’s source code