Cant get lighttpd to work with c++ and fastcgi on Ubuntu
Added by monty808 over 12 years ago
I have tried so hard but I cant get fastcgi to work on Ubuntu.
Here is my C++ code and below is the config file with the error. I am NOT using spwan-fcgi.
What is wrong? I dont know even know how to begin. The c++ complies and when run prints out the following
Content-type: text/html <title>FastCGI Hello!</title><h1>FastCGI Hello!</h1>Request number 2 running on host <i>(null)</i>
server.modules += ( "mod_fastcgi" ) server.document-root = "/var/www/" ## where to send error-messages to server.errorlog = "/etc/lighttpd/error_logs/error.log" index-file.names += ( "rtb.fcgi" ) ##server.max-worker = 1 #Set worker to two times CPU --- workers equal to two times the number of cores fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "/tmp/fastcgi.socket", "bin-path" => "/var/www/rtb.fcgi" ) ) )
#include <stdlib.h> #include <unistd.h> extern char ** environ; #include "fcgio.h" #include "fcgi_config.h" // HAVE_IOSTREAM_WITHASSIGN_STREAMBUF #include "fcgi_stdio.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 <i>%s</i>\n", ++count, getenv("SERVER_NAME")); return 0; }
2012-01-14 19:34:33: (log.c.166) server started 2012-01-14 19:34:33: (mod_fastcgi.c.1104) the fastcgi-backend /var/www/rtb.fcgi failed to start: 2012-01-14 19:34:33: (mod_fastcgi.c.1108) child exited with status 8 /var/www/rtb.fcgi 2012-01-14 19:34:33: (mod_fastcgi.c.1111) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version. If this is PHP on Gentoo, add 'fastcgi' to the USE flags. 2012-01-14 19:34:33: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed. 2012-01-14 19:34:33: (server.c.938) Configuration of plugins failed. Going down.
Replies (2)
RE: Cant get lighttpd to work with c++ and fastcgi on Ubuntu - Added by stbuehler over 12 years ago
8 => ENOEXEC error. file permissions, selinux, apparmor, not a binary?
RE: Cant get lighttpd to work with c++ and fastcgi on Ubuntu - Added by monty808 over 12 years ago
Its a binary, in the /var/www dir. chmod 755 for the binary.
runing ubuntu. CGI works..not fastcgi.