How to get FCGI environment variables
Added by Beat Brand about 10 years ago
Hello
For my FCGI application, I've to use a FCGI variable within the ApplicationCreator callback.
This means, I need the to get the value before I have a Wt::WApplication object created.
If I have already an application, it's easy to get the value with the method getCgiValue("FCGI_VARIABLE_NAME")
but is there a way to get such a value just after creating a Wt::WServer object?
Thanks and regards,
Beat
Replies (3)
RE: How to get FCGI environment variables - Added by Koen Deforche about 10 years ago
I'm not sure, but perhaps they can also be retrieved using the C lib call getenv() ?
RE: How to get FCGI environment variables - Added by Beat Brand about 10 years ago
Thanks Koen
I have tryed this and it works for common environment variables:
char* pPath;
pPath = getenv("WT_TMP_DIR");
if (pPath!=NULL)
printf(">>> environment WT_TMP_DIR: %s\n", pPath);
but unfortunateli it doesn't for the FCGI variables. I use nginx and in the config file, i set the variable as this:
fastcgi_param APP_ID icx; # application id
Is there a way to get the APP_ID in this example in the same way like Wt does it in the ApplicationCreator callback?
Regards
Beat
RE: How to get FCGI environment variables - Added by Koen Deforche about 10 years ago
Reading up on FastCGI in the reference documentation, it seems that these variables only exist within the scope of a request.
So the earliest point at which you can get them is in the createApplication() callback, in which case you can query them from the WEnvironment object.