I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on disp
I wrote a short C program that returns the environment variables passed from nginx to the fastCGI application.
#include
#include
extern char **environ;
int main(int argc, char **argv) {
char *envvar;
int i;
int count = 0;
while(FCGI_Accept() >= 0) {
printf("Content-type: text/html\n\n"
"FastCGI Call Debug Tool \n"
"FastCGI Call Debugging Tool
\n"
"Request number %d running on host %s
\n"
"Environment Variables
\n",
++count, getenv("SERVER_NAME"));
i = 0;
envvar = environ[i];
while (envvar != NULL) {
printf("%s
",envvar);
envvar = environ[++i];
}
printf("
\n");
}
return 0;
}
Save this to a file, e.g. fcgi_debug.c
To compile it, first install gcc
and libfcgi-dev
, then run:
gcc -o fcgi_debug fcgi_debug.c -lfcgi
To run it, install spawn-fcgi
, then run:
spawn-fcgi -p 3000 -f /path/to/fcgi_debug
Then, change your nginx fcgi config to point to the debug program:
fastcgi_pass 127.0.0.1:3000;
Restart nginx, refresh the page, and you should see all the parameters appear in your browser for you to debug! :-)