Hi.
I've got a problem running a cgi-program with embedded html files. It works when running it from the command line, but not when running it in lighttpd. Then I get a 500 - Internal server error [lighttpd errorlog: (mod_cgi.c.607) cgi died, pid: 12688].
What am I doing wrong here?
index.html
Code:
<html>
<body>
<h1>Hello world!</h1>
</body>
</html>
I make a object file of it by
Code:
objcopy -I binary -O elf64-x86-64 -B i386 index.html index.o
main.c
Code:
#include <stdio.h>
extern char _binary_index_html_start[];
extern char _binary_index_html_size;
int main(int argc, char** argv) {
printf("Content-type: text/html\r\nContent-size: %u\r\n\r\n",
&_binary_index_html_size);
fwrite(_binary_index_html_start, 1,
(size_t) &_binary_index_html_size, stdout);
return 0;
}
Code:
gcc -o prob main.c index.o
Thanks for help.