Loading a PHP application / structure into memory only once with FastCGI?

I got the impression that FastCGI allowed you to download your web application once, and then just β€œprovided” FastCGI with some function, for example myHandleHTTPRequest($url) , which will then be called whenever a request arrives. This way you will get much better performance since your application will be ready in memory all the time, right?

But I'm starting to understand that this is not so. Or I'm wrong?

It seems to me that PHP is loading FastCGI, ok, and this gives some improvement, but then my application still reloads on every request.

I want to download one application (or read the "framework") once (and then reload the request every 500 requests). Can I do it?

Edit: this question has been rephrased as follows: FastCGI user interface for PHP

+4
source share
2 answers

Yes, you can do this by more or less forgetting all the bizarre PHP integration materials (this is what gives you the generic -Purpose-PHP-Interpreter-As-FastCGI) and the application itself as a FastCGI server in itself.

Such a whole topic, but you might want to look into how Perl applications go around for guidance.

+2
source

What fastcgi is is to avoid the appearance of a PHP interpreter for each request (e.g. cgi). This saves a huge amount of processing time, since the PHP interpreter is stored in memory, more or less like mod_php.

What you can do to increase productivity:

  • Use APC or xcache, etc., which pre-converts each php file transparently, avoiding recompiling for each request.
  • Caching. Apc and others provide mechanisms for storing variables with a lifespan that spans even between requests. This can be used to exchange processed data between requests and store application data in memory.
+3
source

All Articles