Re: installing Fast CGI with PERL on Solaris 2.5

Ken Alexander (
Wed, 7 May 1997 13:12:11 -0400 (EDT)

Date: Wed, 7 May 1997 13:12:11 -0400 (EDT)
From: Ken Alexander <>
Message-Id: <>
Subject: Re:  installing Fast CGI with PERL on Solaris 2.5 writes:
> Hello all.  I've been beating my brains out on this off and on for a
> week now, with no success.  I have Perl 5.003 patch level 3 installed on
> my Solaris 2.5.1 system.  I have tried both the sfio and fcgi_stdio
> methods for integrating Fast CGI with my Perl.  The instructions at
> do not work for me.  When compiling sfio (97), I get all sorts of errors
> which appear to be coming from the generation of ast_common.h.

On solaris 2.5.1 I could not get sfio to compile with /opt/SUNWspro/bin/cc.
And /usr/ucb/cc is a pile of junk that I would strongly advise against.
I successfully compiled sfio97 with gcc

> I tried to integrate it with my Perl, which seemed to work,
> but then when I tried to make Fast CGI, it said that my Perl did not
> have sfio/perlio. 

I found that I had to add .../sfio/lib to my "library perusal path"
(the one that defaults to something like "/usr/lib /usr/ccs/lib")
or it wouldn't recognize that sfio was there.  
Also, the questions that Configure asks about sfio are now different than
the fastcgi instructions say (possibly with different defaults also),
so read carefully.

*BUT* after all this, sfio fcgi perl has a nasty problem.
When running several fastcgi processes, and requests come in close together,
the process will exit and the client will hang.  The fcgi module bombs in
an accept() call, which causes the perl "while(FCGI::accept() >= 0)" loop
to exit.  I have no idea why this is.  So, I went back to using fcgi_stdio.

> So, I gave up on sfio and tried fcgi_stdio.  I got errors in proto.h
> about aff__ or something like that, which I can't find in there.

Here's what I had to do to make perl work with fcgi_stdio.
This is based loosely on
section 3.2, with some very important differences (such as overcoming
the signal bug):

1. get perl5.002 from and unpack it
   (must be 5.002, because fcgi-devel-kit doesn't support 5.003)

2. get fcgi-devel-kit 2.0b2 from and unpack it

3. setenv CC gcc

4. cd fcgi-devel-kit, configure, make, ignore harmless warnings.

5. cd to the perl5.002 that you unpacked

6. cp ..../fcgi-devel-kit/perl-5/perl5.002/* .
   (replaces Configure, proto.h, perl.c)

7. edit "Configure" to add "$libs" to line 8047:
if $cc $ccflags signal.c -o signal $ldflags $libs >/dev/null 2>&1; then
   (this bugfix is *ESSENTIAL* in order for signals to work)

8. ./Configure.  non-default answers are something like the following,
   with $fcgi being the path of the top level of your fcgi-devel-kit:

- install prefix: wherever you put it.
- blah blah blah dir doesn't exist, use it anyway? y
- C compiler: gcc
- dirs for lib searches: (remove any that are links on your machine)
- ccflags: -I$fcgi/include -include $fcgi/include/fcgi_stdio.h
- ldflags: -L$fcgi/libfcgi
- addl libs: (add "-lfcgi" right before -lc)
- whoa there, blah blah, keep recommended value? n

9. Watch to make sure that Configure thinks the list of signals is something
   sensible like SIGHUP SIGINT SIGQUIT SIGILL etc, and not a bunch of
   evil repeating SIG0 SIG0 SIG0 SIG0 SIG0 etc.

10. make, make test, make install

11. add the FCGI module.
    cd .../fcgi-devel-kit/perl-5/common/ext/FCGI
    where-you-just-installed-fcgi-perl/bin/perl Makefile.PL
    make, make test, make install

Then it works.

 Ken Alexander          JSTOR / UMDL                +1 313 647 6316        University of Michigan      +1 313 647 6897 fax