Author |
|
roeya
Joined: 26 Feb 2008 Posts: 5
|
Posted: Tue 26 Feb '08 18:09 Post subject: Cannot run perl script with mod_fcgid |
|
|
I have a perl script that run ok using FastCGI & Apache2, However when
I tried to convert to mod_fcgid I get many
Code: | [Tue Feb 26 16:56:24 2008] [error] (OS 2)The system cannot find the file specified. : mod_fcgid: can't create process
[Tue Feb 26 16:56:24 2008] [warn] (OS 2)The system cannot find the file specified. : mod_fcgid: spawn process /usr/bin/perl error |
ended by
Code: | [Tue Feb 26 16:56:24 2008] [warn] mod_fcgid: can't apply process slot for /usr/bin/perl |
I the configuration is working for none perl fastcgi executables
Here is the configuration
Code: | LoadModule fcgid_module modules/mod_fcgid.so |
and the following setting for fcgid:
Code: | <IfModule mod_fcgid.c>
IPCCommTimeout 300
IPCConnectTimeout 20
MaxProcessCount 18
OutputBufferSize 64
ProcessLifeTime 3600
MaxRequestsPerProcess 200
</IfModule>
Alias /products/gui/4/ "C:/www/gui/4/"
<Directory "C:/www/gui/4">
Options Indexes +ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AddHandler cgi-script .pl
AddHandler fcgid-script .fpl
</Directory> |
Agian when using FastCGI it works fine converting to mod_fcgid can run fastcgi executables but not perl scripts
I did one more thing: the first line was:
and it runs fine as regular cgi !
I converted it to
Quote: | #!/usr/bin/perl.exe |
now I get
Quote: | [Tue Feb 26 17:59:10 2008] [warn] (OS 109)The pipe has been ended. : mod_fcgid: get overlap result error
[Tue Feb 26 17:59:10 2008] [error] [client 127.0.0.1] Premature end of script headers: main_display.fpl |
What am I missing ?
Last edited by roeya on Thu 28 Feb '08 15:44; edited 1 time in total |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 26 Feb '08 18:54 Post subject: |
|
|
Does C:\usr\bin\perl exist? I think you have to change the shebang line to where ever your perl is. |
|
Back to top |
|
roeya
Joined: 26 Feb 2008 Posts: 5
|
Posted: Tue 26 Feb '08 19:33 Post subject: |
|
|
James Blond wrote: | Does C:\usr\bin\perl exist? I think you have to change the shebang line to where ever your perl is. |
c:\usr\bin\perl.exe exists - we install perl in usr directory this way the same script runs on our win32 platform and on our FreeBSD platforms
And as I said the script runs fine as regular CGI. so no problem on the #! line |
|
Back to top |
|
PipoDeClown
Joined: 20 Dec 2005 Posts: 77
|
Posted: Wed 27 Feb '08 18:55 Post subject: |
|
|
maybe:
Code: |
<Directory "/www/gui/4">
Options ExecCGI Indexes
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex index.html
<FilesMatch "\.fpl$">
SetHandler fcgid-script
FCGIWrapper "/usr/bin/perl.exe" .fpl
</FilesMatch>
</Directory>
|
or something... |
|
Back to top |
|
roeya
Joined: 26 Feb 2008 Posts: 5
|
Posted: Fri 24 Feb '12 15:21 Post subject: mod_fcgid & Perl - not working even after 4 years... |
|
|
Hi,
This problem is annoying me again and again even after 4 years with no solution.
Does anyone wants to fix it ?
I am willing to pay money for a fix ! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
matlads
Joined: 14 Aug 2012 Posts: 1 Location: Uganda, Kampala
|
Posted: Tue 14 Aug '12 18:48 Post subject: |
|
|
I have this setup on my development setup, and something very similar in production.
in my httpd.conf I have this:
Code: | LoadModule fcgid_module
<IfModule fcgid_module>
SocketPath /var/lib/apache2/fcgid/
IPCConnectTimeout 10
IPCCommTimeout 40
AddHandler fcgid-script .fcgi
Alias /fcgi-bin /srv/www/fcgi-bin
<Directory /srv/www/fcgi-bin>
SetHandler fcgid-script
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
</IfModule>
|
and I have this test perl script called /srv/www/fcgi-bin/md.pl
Code: | #!/usr/bin/perl
use DBI;
use CGI::Fast qw(:standard);
use strict;
my $dsn = "dbi:Pg:database=development";
my $dbh = DBI->connect($dsn, "postgres", "password", {RaiseError => 1, AutoCommit => 0});
my $sql = "SELECT id,name,module_id FROM modules WHERE LOWER(name) = ?";
my $sth = $dbh->prepare($sql);
while (my $q = CGI::Fast->new) {
my $name = $q->param('name') || 'default';
$sth->execute( lc($name) );
my $details = $sth->fetchall_arrayref();
print("Content-Type: text/plain\n\n");
foreach my $detail (@$details) {
print "id: $detail->[0], name: $detail->[1], module_id: $detail->[2]\n";
}
}
$dbh->disconnect();
exit (1);
|
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 16 Aug '12 17:32 Post subject: |
|
|
And your question or suggestion is? |
|
Back to top |
|
simonclark
Joined: 02 Feb 2013 Posts: 1 Location: Germany
|
Posted: Sat 02 Feb '13 11:31 Post subject: |
|
|
Thanks to you and god also because i had this type of problem so after many time , i found out thread who will gave me the full solution of my problem . so thanks once again . |
|
Back to top |
|
Piotr_CA
Joined: 04 Jun 2013 Posts: 1 Location: Poland
|
Posted: Thu 06 Jun '13 9:04 Post subject: |
|
|
Hi,
Can you describe the whole solution? I mean example of Apache configuration and example of perl script that presents working FastCGI/FCGI on Windows' environment?
Best regards,
Piotr |
|
Back to top |
|
xinush
Joined: 25 Dec 2013 Posts: 1
|
Posted: Wed 25 Dec '13 17:28 Post subject: |
|
|
Hi,
A possible workaround to run apache + mod_fcgid + perl on a windows platform, similar to FCGI::IIS approach:
1. Create a wrapper module and save it into a proper location (ie. C:\perl\site\lib\FCGI or C:\strawberry\perl\site\lib\FCGI, etc.)
Code: |
package FCGI::CgiWrapper;
use strict;
use warnings;
use FCGI;
our $REQCNT=0;
sub import {
my $request = FCGI::Request();
while($request->Accept() >= 0) {
$REQCNT++;
package main;
do ($ENV{'SCRIPT_FILENAME'}) if ($ENV{'SCRIPT_FILENAME'});
undef @CGI::QUERY_PARAM;
}
}
1;
|
2. Apache configuration for fcgi and perl
Code: |
...(other fcgi confs)...
SetHandler fcgid-script .pl
FcgidWrapper "C:/perl/bin/perl.exe -MFCGI::CgiWrapper" .pl
|
3. A sample perl script
Code: |
package mytest;
use strict;
use CGI;
my $cgi = new CGI;
our $our_counter;
my $my_counter;
print $cgi->header("text/html"),$cgi->start_html("Perl Test");
print $cgi->h1("Perl is working!");
print "our_counter=".(++$our_counter)."<br>";
print "my_counter=".(++$my_counter)."<br>";
print "FCGI::CgiWrapper::REQCNT=".($FCGI::CgiWrapper::REQCNT)."<br>";
print "param=".$cgi->param('param')."<br>";
1;
|
Hope this is useful~ |
|
Back to top |
|