Forum: NGINX nginx perl cgi

8b48382465fba10a27a7bd373485d14f?d=identicon&s=25 Renaud Allard (Guest)
on 2008-03-13 13:24
(Received via mailing list)
Attachment: smime.p7s (3 KB)
Hello,

I have some problems running (perl) cgi scripts with nginx.
I followed the config at http://wiki.codemongers.com/NginxSimpleCGI
Perl scripts work very well as long as they use method=get in forms. If
they use method=post, it seems no input is passed to the cgi.

I saw in perl-fcgi.pl that there was some lines: "if
(($req_params{'REQUEST_METHOD'} eq 'POST') && ($req_len != 0) ){ "
Which should pass the info

Has someone an idea of what's happening?

Regards
C9df7a27848647b08e5a3a3ce0a0b61c?d=identicon&s=25 Denis S. Filimonov (Guest)
on 2008-03-13 18:37
(Received via mailing list)
Attachment: fastcgi-wrapper.pl (3 KB)
I had the same problem some time ago.
The problem with this script is that it violates CGI specifications
regarding
POST requests. POSTed data must come to a CGI app from the standard
input
while this script parses the input and sets variables as if they came
via a
GET request, passing nothing to app's stdin. Thus, applications that
follow
specs strictly and expect POST data from stdin, fail.

I've modified the script to fix the problem, feel free to use it.
8b48382465fba10a27a7bd373485d14f?d=identicon&s=25 Renaud Allard (Guest)
on 2008-03-13 20:34
(Received via mailing list)
Attachment: smime.p7s (3 KB)
Denis S. Filimonov wrote:
> I had the same problem some time ago.
> The problem with this script is that it violates CGI specifications regarding
> POST requests. POSTed data must come to a CGI app from the standard input
> while this script parses the input and sets variables as if they came via a
> GET request, passing nothing to app's stdin. Thus, applications that follow
> specs strictly and expect POST data from stdin, fail.
>
> I've modified the script to fix the problem, feel free to use it.
>

Thanks, it works like a charm.
Fa3dc08a690d3c8f28cec0686a61e2da?d=identicon&s=25 Nz2007 Nz2007 (nzimas)
on 2008-05-24 20:27
Renaud Allard wrote:
> Denis S. Filimonov wrote:
>> I had the same problem some time ago.
>> The problem with this script is that it violates CGI specifications regarding
>> POST requests. POSTed data must come to a CGI app from the standard input
>> while this script parses the input and sets variables as if they came via a
>> GET request, passing nothing to app's stdin. Thus, applications that follow
>> specs strictly and expect POST data from stdin, fail.
>>
>> I've modified the script to fix the problem, feel free to use it.
>>
>
> Thanks, it works like a charm.

I too followed the same tutorial, however, when i try to run the script:

# perl /usr/bin/cgiwrap-fcgi.pl&
[1] 17845
# bind/listen: No such file or directory

(I added & at the end because i use Bash).

Hints are much welcome.

Nuno.
24c68be9fa93c1fa7583c70ae50c9a6e?d=identicon&s=25 Master Volkov (master_volkov)
on 2009-03-26 21:05
Nz2007 Nz2007 wrote:
>
> I too followed the same tutorial, however, when i try to run the script:
>
> # perl /usr/bin/cgiwrap-fcgi.pl&
> [1] 17845
> # bind/listen: No such file or directory
>
> (I added & at the end because i use Bash).
>
> Hints are much welcome.
>
> Nuno.


Look like a dir /var/run/nginx not created

they need by created and you need permission for write into it
Fb7188d8be002ece64870dffe9ec6fa7?d=identicon&s=25 S. B. (polemon)
on 2010-08-08 03:41
I'd like a solution with using spawn-fcgi.

As I understand it, that Perl wrapper forks into background itself.

I have a script where I load all FastCGI wrappers from:

spawn-fcgi -C 3 -u www-data -s /var/run/php-fcgi.sock -P
/var/run/php-fcgi.pid -- /usr/bin/php5-cgi
spawn-fcgi -F 3 -u www-data -s /var/run/lua-fcgi.sock -P
/var/run/lua-fcgi.pid -- /usr/bin/wsapi.fcgi

it works very well that way, and I have PID files, that I can use to
kill the wrappers with:

kill $(cat /var/run/php-fcgi.pid)
kill $(cat /var/run/lua-fcgi.pid)

I'd like a Perl wrapper that works in the same way, meaning that I'd
pass most stuff with spawn-fcgi. Also, It would give me the possibility
of controlling how many children I want to spawn (-F switch).

Is there a solution that uses spawn-fcgi? I was looking for something
like that, But there's only little, and most of it is quite confusing.

Regards,
--polemon
1f11cb878950202ef2a779eec37fa531?d=identicon&s=25 Peter Vandenberghe (petervdb)
on 2014-07-13 22:13
Denis S. Filimonov wrote in post #645832:
> I had the same problem some time ago.
> The problem with this script is that it violates CGI specifications
> regarding
> POST requests. POSTed data must come to a CGI app from the standard
> input
> while this script parses the input and sets variables as if they came
> via a
> GET request, passing nothing to app's stdin. Thus, applications that
> follow
> specs strictly and expect POST data from stdin, fail.
>
> I've modified the script to fix the problem, feel free to use it.

Hi Denis,

Do you have an alternative solution for Windows?
Syscall and setsid is not working in Windows environments.

Regards,
Peter
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.