简体   繁体   中英

Why does my perl fastcgi script does not open socket

I am write a simple perl FasCGI script by example

#!/usr/bin/perl -w
use strict;

use FCGI;

my $count = 0;
my $request = FCGI::Request();

while($request->Accept() >= 0) {
    print("Content-type: text/html\r\n\r\n", ++$count);
}

than i am making this script executable and executing it in terminal, but instead of opening the socket, that script prints

Content-type: text/html

1

and ends. Why?

UPDATE

Thanks guys, but I don't understand one moment, how my script know, i installed or not web server module?And why i need server for normally run fastcgi script? for example when I run Catalyst fastcgi starter, I don't need any server, and I can run that script in any machine, without server.

Please check the Installing FastCGI section from the following link. I believe you are missing this. http://www.intranetwerx.com/bookshelf2/linux/cgi/ch17_02.htm

It's a debugging mode. Rather than dying because you didn't provide a proper Fast CGI environment, it simulates a single request.

unless ($req->IsFastCGI()) {
    return -1 if $run_once;

    $run_once = 1;
    return 0;
}

You do realize that Fast CGI is a communication protocol used to communicate between your script and a module in your web server, right? You need to have the web server module launch your script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM