Below is my c++ code and my config file.
when I run spawn-fcgi -a120.0.0.1 -p9000 -n ./rtb.o
I get this error
spawn-fcgi: exec failed: Exec format error
Here is my c++ code that I complied as rtb.o
#include "fcgi_stdio.h"
#include <stdlib.h>
using namespace std;
int main()
{
int count = 1;
while(FCGI_Accept() >= 0)
printf("Content-type: text/html\r\n"
"\r\n"
"<title>FastCGI Hello!</title>"
"<h1>FastCGI Hello!</h1>"
"Request number %d running on host \n",
++count);
return 0;
}
So, what did I do wrong?
You’re attempting to run a program called
rtb.o? Is this an object file or an executable? You might want to show us how you compile your program. If you’re doing something likeThen you will get an object file and you need to link it to get a working program. Try to run it from your terminal using
./rtb.o. If it prints the same message, then you’ve got an object file and need to try something like this instead:Remember to add a reference to the FCGI library when you link (use the
-loption).