LunpaCMS Whipping your website into shape! Introducing Lunpa, our mascot.  Her mother was a hamster and her father was Chilean M00se.  Oddly, neither smelt of elderberries.


LunpaCMS FastCGI Documentation

A Quick Introduction

The Basics

To enable FastCGI, add the following rules to your .htaccess file:

<files ~ "\.cgim$">
  sethandler fcgid-script
</files>

<files ~ "news_article\.cgi$">
  sethandler fcgid-script
</files>

To change the number of iterations your scripts run for before terminating, set $Library_global::fcgi_max_iterations in your local.cnf file. The default is 100 iterations. This number should be less than or equal to the maximum number of iterations as set in your httpd.conf.

Converting from CGI to FastCGI

To convert an old CGI script to work with FastCGI, do the following:

  1. Replace the call to &main(%params); with:
    &Library_global::fcgi_main(sub {
      &main(%params, fcgi_var=>$_[0]);
    });
  2. Add my ($exit); to the top of your main function.
  3. Change any calls to handle_cookies_sessions with:
    $exit = &Library_global::handle_cookies_sessions(...);
    if ($exit > 0) {
      return;
    }
  4. Change any calls to login_user with:
    $exit = &Library_global::login_user(...);
    if ($exit > 0) {
      return;
    }
  5. Add fcgi_object=>$params{'fcgi_var'} as a parameter to get_form_hash.
  6. Replace any instances of exit; in main with return;.

Profiling

LunpaCMS supports profiling for both compilation time and page request runtime. To use this feature, set $Library_global::cgi_profiling = 1; in your local.cnf. To add profiling support to other scripts, use the code below.

&Library_global::fcgi_main(sub {
  &Library_global::profile_compile(database=>$Library_phw::database, my_cnf=>$Library_phw::my_cnf);
  &Library_global::profile_main(database=>$Library_phw::database, my_cnf=>$Library_phw::my_cnf, sub {
    &main(admin=>0, force_ssl=>0, fcgi_var=>$_[0]);
  });
});

Add Your Comment


(Only a limited set of HTML tags such as <b>, <i>, <u> are allowed. Embedded flash video from Youtube or Vimeo are also supported.)


Copyright © 2018 Peregrine Computer Consultants Corp. All rights reserved.

About Lunpa, our mascot. Her mother was a hamster and her father was an ill-tempered Chilean M00se. Oddly, neither smelt of elderberries.
The artist is Jennifer Lomax.