Hi, We want some URLs handled with modperl and others with regular CGI handling in one Apache installation, and assume that is possible. However, once an apache2 process has handled a modperl script, it seems apache2 doesn't deliver anything on STDIN to other unrelated cgi subprocesses. This makes POST requests misbehave in our CGI processes as if there were no form parameters. http://marc.info/?l=apache-modperl&m=117507879929572&w=2 has a similar thread, but no solution seemed to be found. Is there any way to get the apache2 process back-to-normal for regular CGI handling? Alternatively, is there any way to get apache to use some processes for modperl and others for regular CGI so they are kept safely apart?Otherwise, it seems, that if modperl is used, then apache turns into modperl-only. Can that really be true?
Test procedure:
* Create a minimal network install using debian etch.
* Install apache2-mpm-prefork and libapache2-mod-perl2
* Put test.conf (see below) into /etc/apache2/conf.d
* put normal.cgi (see below) into /opt/test
* ln -s /opt/test/normal.cgi /opt/test/mod.cgi
( so normal.cgi and mod.cgi "by coincidence" have the same
implementation. normal.cgi configured to use cgi-script,
mod.cgi configured to use modperl. See test.conf below. )
# Testcase 1 - all is normal and OK
* /etc/init.d/apache2 restart
* Point browser to http://server/test/normal.cgi
* Hit Submit
* See, that STDIN from the CGI *does* contain
the submit parameter. (Input is shown as
{submit=Submit} )
# Testcase 2 - Visit a mod-perl script first and see that STDIN is
messed up for the CGI. Timing is of the essence
(I think), so don't wait more than 2-3 seconds between
browser requests.
* /etc/init.d/apache2 restart
* Point browser to http://server/test/mod.cgi
* Point browser to http://server/test/normal.cgi
* Hit Submit
* See, that STDIN from the CGI *does not* contain
the submit parameter. (Input is shown as {})
Isn't that a bug? Any workarounds?
*******************************************
test.conf
*******************************************
Alias /test /opt/test
<Directory /opt/test>
Options +FollowSymLinks +Indexes
Options +ExecCGI +MultiViews
</Directory>
<LocationMatch "^/test/mod.cgi$">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
</LocationMatch>
<LocationMatch "^/test/normal.cgi$">
SetHandler cgi-script
</LocationMatch>
*******************************************
normal.cgi / mod.cgi
*******************************************
#!/usr/bin/perl -w
use strict;
my $submit = join("",<>);
my $forest = `ps -U www-data --forest`;
my $perl = (defined $ENV{MOD_PERL}) ? "mod-perl" : "perl";
print <<END;
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
<h1>Test</h1>
<a href="mod.cgi">mod.cgi</a><br>
<a href="normal.cgi">normal.cgi</a><br><br>
<form method="post"><input type="submit" name="submit"
value="Submit"></form>
<hr>
Output: {$submit}<br>
PID: $$<br>
Perl: $perl<br>
<pre>
$forest
</pre>
</body>
</html>
END
--
Peter Valdemar Mørch
http://www.morch.com
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.