I plan to use php in the embedded environment. Our current web server is thttpd. I am considering two options: whether to run it as cgi or as an SAPI module. I know cgi has a security advantage. But if we use php as cgi, then the php instance must be loaded into memory for each request.
I tried to compile it as an SAPI module for thttpd, and I noticed that the memory usage of thttpd, in particular rss, does not increase as the number of requests increases.
Can someone explain how thttpd loads php? Does it boot only once and remain in memory as long as thttpd is running? If so, we can consider this as an alternative to cgi.
Does it perform multithreading, that is, if there are several HTTP requests at the same time? or is it processing the request one at a time?
Is there any good documentation discussing the behavior of php as a thttpd module?
source
share