Menu

FASTCGI perl and Pi3web

John Huong
2002-06-21
2002-06-22
  • John Huong

    John Huong - 2002-06-21

    How do I go about this? I know Pi3web supports thism but how do I configure for this?

     
    • Holger Zimmermann

      Hi John,

      I think this is much easier to answer than the last one...

      Prefs.:

      - You need a fastcgi app.-server running and serving the perl application for this 1).
      - ./Conf/Features.pi3 contains already a sample fastcgi configuration

      ToDo.:

      - Edit the fastcgi mappings in ./Conf/Features.pi3 to point to the required URI's.
      - For each application (script) there's a "proxy-file" in ./Pi3Web/cgi-fcgi. The URI is mapped to the physical path of this file
      - Edit this file(s) to point to the hostname/port, where the FastCGI server listens for requests for that applications you installed.

      Hints:

      - The Pi3Web FastCGI handler object is described here: http://localhost/pidocs/Objects/Fcgi.html
      - As you can read in the release notes of Pi3Web 2.0 I fixed a bug in the FastCGI handler related to large response data streams. this wasn't fixed in the 2.0 beta 2 yet.

      1)   I tested Pi3Web 2.0 successfully the FastCGI C/C++ Development-Kit 2.0 (http://www.fastcgi.com) on Linux and Windows (current version is 2.2).

       
    • John Huong

      John Huong - 2002-06-22

      fastcgi -app server? Isn't pi3web one?

       
    • Holger Zimmermann

      Hi John,

      this depends on the way you are using fastcgi. From
      the webserver perspective, the fastcgi application
      can be operated either as remote server in the backend
      or as an application running under control of the webserver.
      Pi3Web supports only the remote server model, which
      seems to be more flexible and scalable.

      The FastCGI application (as remote, standalone process)
      listens at the specified tcp address and handles incoming
      traffic accordingly to the FastCGI protocol. The development
      kit is required, to enable e.g. your native c/c++ application
      to support the FastCGI interface.

      For perl e.g. the FCGI module (http://www.cpan.org/modules/by-module/FCGI/,
      based on the same dev.-kit from OpenMarket internally), provides
      the protocol implementation for your perl applications.

      So I assume, to serve your perl application, you only need to add
      FCGI to your perl installation, if not yet done. (In the perl code you
      should find "use FCGI;" somewhere to determine this is correct).

      If module FCGI is really needed but not yet installed, you can obtain
      it with your browser from the web or better directly from CPAN using perl:

      perl -MCPAN -e "install FCGI"

      I just tried this on my linux and the example scripts delivered with the
      FCGI module worked at once.

      In the perl fastcgi application the difference between the hosted and the
      standalone, remote variant is considered by opening a socket for the
      last one:

      my $socket = FCGI::OpenSocket( ":8888", 5 );
      my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR,
          \%ENV, $socket );

      my $count;
      while( $request->Accept() >= 0 ) {
          print "Content-type: text/html\r\n\r\n";
          print ++$count;
      }

      FCGI::CloseSocket( $socket );

      Here the other variant, which won't work with Pi3Web:

      my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR,
         \%ENV );

      my $count;
      while( $request->Accept() >= 0 ) {
          print "Content-type: text/html\r\n\r\n";
          print ++$count;
      }

      --
      regards,
      Holger

       

Log in to post a comment.