Trouble configuring FastCGI

Hey everyone,

I’m in the process of converting RT 3.2 from a Debian system running Apache
1.3 and mod_perl 1 to RHEL4 with Apache 2 and FastCGI. I think I’ve got RT
set to go, but I’m stuck with the FastCGI. I’ve never used FastCGI before so
I’m trying to follow the instructions the wiki closely. (
http://wiki.bestpractical.com/index.cgi?FastCGIConfiguration)

I’m trying to get RT to run as a static/external FastCGI, but the init
script on the wiki isn’t working. I’ve got:

#!/bin/sh

RTPATH=/opt/rt
RTUSER=apache
FCGI_SOCKET_PATH=$RTPATH/var/appSocket
PERLPATH=/opt/perl/bin/perl

case $1 in
start)
echo -n "Starting RT: mason_handler.fcgi"
cd $RTPATH
export FCGI_SOCKET_PATH
su $RTUSER -c $PERLPATH bin/mason_handler.fcgi &
echo
;;

stop)
    echo -n "Stopping RT: "
    pids=`ps axww | awk '/[m]ason_handler.fcgi/ { print $1}'`
    if [ -n "$PIDS" ]
    then
        echo -n kill -TERM $PIDS
        kill $PIDS
        echo
    else
        echo RT not running
    fi
    ;;

restart:force-reload)
    $0 stop
    $0 start
    ;;

*)
    echo "Usage: /etc/init.d/rt { stop | start | restart }"
    exit 1
    ;;

esac

But it fails silently and the mason_handler doesn’t start. (I did change the
RTUSER to apache since the directions seemed to suggest to configure RT so
it was run by the web user.)

Interestingly, if I su apache and run the mason_handler.fcgi directly it
generates the HTML for the RT homepage.

Anybody got RT working in the configuration I’m trying
(RHEL4/Apache2/FastCGI)? If so, I could really use some suggestions. A
recipe on the wiki would be great! If I get this working, I’ll do it myself.

-Tim

Timothy Wilson
Technology Integration Specialist
Hopkins ISD #270, Hopkins, MN, USA (44š56.013’N 93š24.736’W)
ph: 952.988.4103 fax: 952.988.4311 AIM: tis270

Tim Wilson wrote:

Hey everyone,

I’m in the process of converting RT 3.2 from a Debian system running Apache
1.3 and mod_perl 1 to RHEL4 with Apache 2 and FastCGI. I think I’ve got RT
set to go, but I’m stuck with the FastCGI. I’ve never used FastCGI before so
I’m trying to follow the instructions the wiki closely. (
http://wiki.bestpractical.com/index.cgi?FastCGIConfiguration)

I’m trying to get RT to run as a static/external FastCGI, but the init
script on the wiki isn’t working. I’ve got:

#!/bin/sh

RTPATH=/opt/rt
RTUSER=apache
FCGI_SOCKET_PATH=$RTPATH/var/appSocket
PERLPATH=/opt/perl/bin/perl

case $1 in
start)
echo -n "Starting RT: mason_handler.fcgi"
cd $RTPATH
export FCGI_SOCKET_PATH
su $RTUSER -c $PERLPATH bin/mason_handler.fcgi &
echo
;;

stop)
    echo -n "Stopping RT: "
    pids=`ps axww | awk '/[m]ason_handler.fcgi/ { print $1}'`
    if [ -n "$PIDS" ]
    then
        echo -n kill -TERM $PIDS
        kill $PIDS
        echo
    else
        echo RT not running
    fi
    ;;

restart:force-reload)
    $0 stop
    $0 start
    ;;

*)
    echo "Usage: /etc/init.d/rt { stop | start | restart }"
    exit 1
    ;;

esac

But it fails silently and the mason_handler doesn’t start. (I did change the
RTUSER to apache since the directions seemed to suggest to configure RT so
it was run by the web user.)

Interestingly, if I su apache and run the mason_handler.fcgi directly it
generates the HTML for the RT homepage.

Anybody got RT working in the configuration I’m trying
(RHEL4/Apache2/FastCGI)? If so, I could really use some suggestions. A
recipe on the wiki would be great! If I get this working, I’ll do it myself.

-Tim

Tim,

I have been trying to get things going with apache2 and fastcgi as well,
though I did not try the starting separate method that you referenced
above. Instead I was trying to get apache to call the mason handler when
apache started up.

I was able to get things going using the fastcgi example at the top of
http://wiki.bestpractical.com/index.cgi?MultipleInstances , modified to
only deal with one instance. I think the only other step I had to do was
to change my site config file so that the apache user could read it.

If you choose to go this route my suggestions are: start with a very
simple site config, get the login page working using that simple
config, and then make things more complicated.

Report back if you have any luck!
Sam

Hey everyone,

I think I’m getting closer to getting FastCGI working with RT 3.2 on my
RHEL4 box. I’ve been trying to combine advice from the list and wiki to come
up with something that works. I get an Internal Server Error with the
following errors logged:

[Mon Mar 14 10:50:31 2005] [error] [client 10.50.21.25] (13)Permission
denied: FastCGI: failed to connect to server
"/opt/rt/bin/mason_handler.fcgi": connect() failed
[Mon Mar 14 10:50:31 2005] [error] [client 10.50.21.25] FastCGI: incomplete
headers (0 bytes) received from server “/opt/rt/bin/mason_handler.fcgi”

My apache config looks like this:

FastCgiServer /opt/rt/bin/mason_handler.fcgi
ScriptAlias / /opt/rt/bin/mason_handler.fcgi/

<VirtualHost 198.174.221.29>
DocumentRoot /opt/rt/share/html
DirectoryIndex index.html index.htm index.shtml

CustomLog logs/support-access_log combined
ErrorLog logs/support-error_log
HostNameLookups off

AddHandler fastcgi-script fcgi
<Directory “/opt/rt/share/html”>
Options FollowSymLinks ExecCGI
AllowOverride None

I’m stumped. Any suggestions?

-Tim

Timothy Wilson
Technology Integration Specialist
Hopkins ISD #270, Hopkins, MN, USA (44š56.013’N 93š24.736’W)
ph: 952.988.4103 fax: 952.988.4311 AIM: tis270

Tim Wilson wrote:

Hey everyone,

I think I’m getting closer to getting FastCGI working with RT 3.2 on my
RHEL4 box. I’ve been trying to combine advice from the list and wiki to come
up with something that works. I get an Internal Server Error with the
following errors logged:

[Mon Mar 14 10:50:31 2005] [error] [client 10.50.21.25] (13)Permission
denied: FastCGI: failed to connect to server
"/opt/rt/bin/mason_handler.fcgi": connect() failed
[Mon Mar 14 10:50:31 2005] [error] [client 10.50.21.25] FastCGI: incomplete
headers (0 bytes) received from server “/opt/rt/bin/mason_handler.fcgi”

My apache config looks like this:

FastCgiServer /opt/rt/bin/mason_handler.fcgi
ScriptAlias / /opt/rt/bin/mason_handler.fcgi/

<VirtualHost 198.174.221.29>
DocumentRoot /opt/rt/share/html
DirectoryIndex index.html index.htm index.shtml

CustomLog logs/support-access_log combined
ErrorLog logs/support-error_log
HostNameLookups off

AddHandler fastcgi-script fcgi
<Directory “/opt/rt/share/html”>
Options FollowSymLinks ExecCGI
AllowOverride None

I’m stumped. Any suggestions?

-Tim

Tim,

Here is what I see when I restart my apache server (in the error log).
Are you seeing something similar, and is the error message you posted
coming when you try to access the index.html page?

[Sun Mar 13 22:24:29 2005] [notice] caught SIGTERM, shutting down

[Sun Mar 13 22:24:32 2005] [notice] FastCGI: process manager initialized
(pid 5296)

[Sun Mar 13 22:24:32 2005] [warn] FastCGI: server
"/usr/share/request-tracker3.4/libexec/mason_handler.fcgi" started (pid
5297)

[Sun Mar 13 22:24:34 2005] [notice] Apache/2.0.53 (Debian GNU/Linux)
mod_fastcgi/2.4.2 PHP/4.3.10-8 mod_ssl/2.0.53 OpenSSL/0.9.7e configured

The key line above is the “mason_handler.fcgi” started" part. The
handler is being started by your “FastCgiServer” line in your apache
config.

Sam

One more hint. Do something like

/etc/init.d/apache2 stop; /etc/init.d/apache2 start;

when you need to restart apache2 and see if your changes made a
difference. Just doing a “restart” does not cut it according to some on
line docs.

Sam

One more hint. Do something like

/etc/init.d/apache2 stop; /etc/init.d/apache2 start;

when you need to restart apache2 and see if your changes made a
difference. Just doing a “restart” does not cut it according to some on
line docs.

Most init scripts seem to do ‘$0 stop; $0 start’ when they’re called as
restart, which should be good enough. ‘reload’, on the other hand,
might be a different story.

Cheers,
– jra
Jay R. Ashworth jra@baylink.com
Designer Baylink RFC 2100
Ashworth & Associates The Things I Think '87 e24
St Petersburg FL USA http://baylink.pitas.com +1 727 647 1274

  If you can read this... thank a system adminstrator.  Or two.  --me

Here is what I see when I restart my apache server (in the error log).
Are you seeing something similar, and is the error message you posted
coming when you try to access the index.html page?

[Sun Mar 13 22:24:29 2005] [notice] caught SIGTERM, shutting down

[Sun Mar 13 22:24:32 2005] [notice] FastCGI: process manager initialized
(pid 5296)

[Sun Mar 13 22:24:32 2005] [warn] FastCGI: server
"/usr/share/request-tracker3.4/libexec/mason_handler.fcgi" started (pid
5297)

[Sun Mar 13 22:24:34 2005] [notice] Apache/2.0.53 (Debian GNU/Linux)
mod_fastcgi/2.4.2 PHP/4.3.10-8 mod_ssl/2.0.53 OpenSSL/0.9.7e configured

Thanks Sam,

I also added the following line to my apache config (outside of the RT
virtual host). I set the owner of that directory to apache and, just for
testing purposes, made permissions wide open (777).

FastCgiIpcDir /var/run/httpd/fastcgi

Here’s what my logs show when I restart apache.

[Mon Mar 14 11:41:42 2005] [notice] FastCGI: process manager initialized
(pid 6393)
[Mon Mar 14 11:41:42 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" started (pid 6394)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6394),
execle() failed: Permission denied
[Mon Mar 14 11:41:42 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6394) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:42 2005] [notice] mod_python: Creating 4 session mutexes
based on 150 max processes and 0 max threads.
[Mon Mar 14 11:41:42 2005] [notice] Apache/2.0.52 (Red Hat) configured –
resuming normal operations
[Mon Mar 14 11:41:47 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" restarted (pid 6403)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6403),
execle() failed: Permission denied
[Mon Mar 14 11:41:47 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6403) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:52 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" restarted (pid 6404)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6404),
execle() failed: Permission denied
[Mon Mar 14 11:41:52 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6404) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:57 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" restarted (pid 6405)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6405),
execle() failed: Permission denied
[Mon Mar 14 11:41:57 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6405) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:57 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" has failed to remain running for 30 seconds
given 3 attempts, its restart interval has been backed off to 600 seconds

It looks a permissions problem somewhere. Any ideas?

-Tim

Timothy Wilson
Technology Integration Specialist
Hopkins ISD #270, Hopkins, MN, USA (44š56.013’N 93š24.736’W)
ph: 952.988.4103 fax: 952.988.4311 AIM: tis270

Tim Wilson wrote:> On 3/14/05 11:15 AM, “Sam Snow” sam.snow@christianheritageschool.org wrote:

Here is what I see when I restart my apache server (in the error log).
Are you seeing something similar, and is the error message you posted
coming when you try to access the index.html page?

[Sun Mar 13 22:24:29 2005] [notice] caught SIGTERM, shutting down

[Sun Mar 13 22:24:32 2005] [notice] FastCGI: process manager initialized
(pid 5296)

[Sun Mar 13 22:24:32 2005] [warn] FastCGI: server
"/usr/share/request-tracker3.4/libexec/mason_handler.fcgi" started (pid
5297)

[Sun Mar 13 22:24:34 2005] [notice] Apache/2.0.53 (Debian GNU/Linux)
mod_fastcgi/2.4.2 PHP/4.3.10-8 mod_ssl/2.0.53 OpenSSL/0.9.7e configured

Thanks Sam,

I also added the following line to my apache config (outside of the RT
virtual host). I set the owner of that directory to apache and, just for
testing purposes, made permissions wide open (777).

FastCgiIpcDir /var/run/httpd/fastcgi

Here’s what my logs show when I restart apache.

[Mon Mar 14 11:41:42 2005] [notice] FastCGI: process manager initialized
(pid 6393)
[Mon Mar 14 11:41:42 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" started (pid 6394)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6394),
execle() failed: Permission denied
[Mon Mar 14 11:41:42 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6394) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:42 2005] [notice] mod_python: Creating 4 session mutexes
based on 150 max processes and 0 max threads.
[Mon Mar 14 11:41:42 2005] [notice] Apache/2.0.52 (Red Hat) configured –
resuming normal operations
[Mon Mar 14 11:41:47 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" restarted (pid 6403)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6403),
execle() failed: Permission denied
[Mon Mar 14 11:41:47 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6403) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:52 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" restarted (pid 6404)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6404),
execle() failed: Permission denied
[Mon Mar 14 11:41:52 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6404) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:57 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" restarted (pid 6405)
FastCGI: can’t start server “/opt/rt/bin/mason_handler.fcgi” (pid 6405),
execle() failed: Permission denied
[Mon Mar 14 11:41:57 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" (pid 6405) terminated by calling exit with
status ‘255’
[Mon Mar 14 11:41:57 2005] [warn] FastCGI: server
"/opt/rt/bin/mason_handler.fcgi" has failed to remain running for 30 seconds
given 3 attempts, its restart interval has been backed off to 600 seconds

It looks a permissions problem somewhere. Any ideas?

-Tim

Not sure. I just googled for that error and could only find two
references to similar stuff:

http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/131807
http://marc.free.net.ph/message/20041230.004507.b04e50e7.en.html
(unanswered post to RT mailing list).

Maybe someone else will have an idea.

Your RT_SiteConfig.pm is readable by the apache2 user, correct?

Sam