httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Gration <>
Subject Re: [users@httpd] Help running perl cgi over apache
Date Tue, 17 Feb 2004 13:21:24 GMT
michael watson (IAH-C) wrote:
 > Hello
 > At first I thought this was something to do with perl, now maybe I
 > think it is something wrong with my apache set up.
 > I am running Suse linux 8.2, Perl 1.5.8, Apache 1.3.28.
 > I have a perl script which fires off a shell script and then exits.
 > It does this as the shell script takes about 30 minutes to run, so
 > perl doesn't want to wait around.  In it's most basic form the script
 > looks like this:
 > #!/usr/bin/perl print "Content-type: text/plain\n\n"; system("/bin/sh
 > /path/to/command &"); print "Finished\n";
 >> From the command line, this works fine - the script fires off the
 >> process in the background and exits.  However, if I stick the exact
 >> same script in my cgi-bin directory, the perl script then waits for
 >> system() call to return i.e. my cgi script takes as long to run as
 >> the shell script does, i.e. it doesn't run it in the background,
 >> i.e. my server times out.
 > The fact that a script run on the command line works, but the
 > behaviour changes over cgi makes me think maybe I am doing something
 > wrong with my apache config.
 > Any ideas?
 > Thanks Mick


If this is really all that your perl script does, then you might have
better luck not using perl at all. Simply write your script as a shell
script (change the shebang line if bash is not on your system):

/path/to/command &
echo -ne "Content-Type: text/plain\r\n\r\n"
echo "Finished"

As long as the script is in a ScriptAlias directory it should run fine.
If it's not, you'll have to associate it's extension with the cgi-script


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message