Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello Monks,

Your wisdom once again is appreciated. I've been testing some FCGI scripts, I've managed to get CGI::Fast working, but I'd like to get FCGI working. Unfortunately, I haven't be able to find good working examples. I'd like to see an example of FCGI return $ENV vars, similar to the CGI::Fast used in the Apache example: https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html. The code posted below is just me trying to get something to work, it is giving an internal server error. I've posted this is from my error log:

[Mon Jan 27 19:44:02.915926 2020] [fcgid:warn] [pid 20681] (104)Connec +tion reset by peer: [client xx.xxx.xxx.xxx:xxxxx] mod_fcgid: error re +ading data from FastCGI server [Mon Jan 27 19:44:02.915973 2020] [core:error] [pid 20681] [client xx. +xxx.xxx.xxx:xxxxx] End of script output before headers: test.fcgi <code> <code> #!/usr/bin/perl use FCGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use Encode; #use CGI::Fast; #the CGI:Fast example from https://httpd.apache.org/mod_fcgid/mod/mod_ +fcgid.html is working; my FCGI example is not. my $count = 0; my $request = FCGI::Request(); while($request->Accept() >= 0) { $body = "Content-type:text/html; charset=utf-8\r\n\r\n"; $body .= '<html><head><meta http-equiv="Content-Type" content="te +xt/html; charset=utf-8" /></head><body>'; $body .= '<h1>Woohoooo!</h1>': $body .= '</body></html>'; $body .= '</body></html>'; $body = encode_utf8($body); print $body; }

Aside from that, I have a very basic question with FastCGI - as it keeps a persistent connection, whats the best way to temporarily test it? I am new to FastCGI, it is compelling, but I don't know the vernacular to describe it well (yet). Let me know if the above doesn't make sense. Secondly, is there a way to get more descriptive error messages than the ones that come out of apache.log?

And yes! I will look into frameworks like Plack/Dancer - but before I do, I'd like to get grasp of how FCGI works before I put a layer on top of it.


In reply to Perl FCGI Error: mod_fcgid: error reading data from FastCGI server by knox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found