Web Extensions and Applications Using FastCGI

By Scott Dybiec and Philip Rousselle

Dr. Dobb's Journal June 1997

(a)
#include <time.h>
main()
{
   time_t tod;
   printf("Content-type: text/html\r\n");
   printf("\r\n");
   time(&tod);
   printf("The current time of day is %s <BR>", ctime(&tod));
}
(b)
#include <time.h>
#include <fcgi_stdio.h>
 
main()
{
   time_t tod;
   while(FCGI_Accept() >= 0) {
      printf("Content-type: text/html\r\n");
      printf("\r\n");
      time(&tod);
      printf("The current time of day is %s <BR>", ctime(&tod));
   }
   exit(0);
}
(c)
AppClass /server-root/fcgi-executables/tod.fcgi
(d) 
<Directory /server-root/fcgi-executables>
AddType application/x-httpd/x-httpd-fcgi .fcgi
</Directory>

Example 1: Converting CGI to FastCGI.

Back to Article


Copyright © 1997, Dr. Dobb's Journal