You can pass environment variables to CGI scripts as well. In fact, that's exactly how CGI works. Shared resources can be cached in memory through redis, although a shared file (for example sqlite) is enough in many cases.
> I don't need Apache + fastCGI + php + php fastCGI + apache configuration to get started
I'm talking about CGI, not fastCGI