{
    "mode": "perldoc",
    "parameter": "FCGI",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/FCGI/json",
    "generated": "2026-06-18T01:21:45Z",
    "synopsis": "use FCGI;\nmy $count = 0;\nmy $request = FCGI::Request();\nwhile($request->Accept() >= 0) {\nprint(\"Content-type: text/html\\r\\n\\r\\n\", ++$count);\n}",
    "sections": {
        "NAME": {
            "content": "FCGI - Fast CGI module\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use FCGI;\n\nmy $count = 0;\nmy $request = FCGI::Request();\n\nwhile($request->Accept() >= 0) {\nprint(\"Content-type: text/html\\r\\n\\r\\n\", ++$count);\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Functions:\n\nFCGI::Request\nCreates a request handle. It has the following optional parameters:\n\ninput perl file handle (default: \\*STDIN)\noutput perl file handle (default: \\*STDOUT)\nerror perl file handle (default: \\*STDERR)\nThese filehandles will be setup to act as input/output/error on successful Accept.\n\nenvironment hash reference (default: \\%ENV)\nThe hash will be populated with the environment.\n\nsocket (default: 0)\nSocket to communicate with the server. Can be the result of the OpenSocket function.\nFor the moment, it's the file descriptor of the socket that should be passed. This\nmay change in the future.\n\nYou should only use your own socket if your program is not started by a process\nmanager such as modfastcgi (except for the FastCgiExternalServer case) or cgi-fcgi.\nIf you use the option, you have to let your FastCGI server know which port (and\npossibly server) your program is listening on. See remote.pl for an example.\n\nflags (default: FCGI::FAILACCEPTONINTR)\nPossible values:\n\nFCGI::FAILACCEPTONINTR\nIf set, Accept will fail if interrupted. It not set, it will just keep\non waiting.\n\nExample usage: my $req = FCGI::Request;\n\nor: my %env; my $in = new IO::Handle; my $out = new IO::Handle; my $err = new IO::Handle; my\n$req = FCGI::Request($in, $out, $err, \\%env);\n\nFCGI::OpenSocket(path, backlog)\nCreates a socket suitable to use as an argument to Request.\n\npath    Pathname of socket or colon followed by local tcp port. Note that some systems take\nfile permissions into account on Unix domain sockets, so you'll have to make sure\nthat the server can write to the created file, by changing the umask before the call\nand/or changing permissions and/or group of the file afterwards.\n\nbacklog Maximum length of the queue of pending connections. If a connection request arrives\nwith the queue full the client may receive an error with an indication of\nECONNREFUSED.\n\nFCGI::CloseSocket(socket)\nClose a socket opened with OpenSocket.\n\n$req->Accept()\nAccepts a connection on $req, attaching the filehandles and populating the environment hash.\nReturns 0 on success. If a connection has been accepted before, the old one will be finished\nfirst.\n\nNote that unlike with the old interface, no die and warn handlers are installed by default.\nThis means that if you are not running an sfio enabled perl, any warn or die message will\nnot end up in the server's log by default. It is advised you set up die and warn handlers\nyourself. FCGI.pm contains an example of die and warn handlers.\n\n$req->Finish()\nFinishes accepted connection. Also detaches filehandles.\n\n$req->Flush()\nFlushes accepted connection.\n\n$req->Detach()\nTemporarily detaches filehandles on an accepted connection.\n\n$req->Attach()\nRe-attaches filehandles on an accepted connection.\n\n$req->LastCall()\nTells the library not to accept any more requests on this handle. It should be safe to call\nthis method from signal handlers.\n\nNote that this method is still experimental and everything about it, including its name, is\nsubject to change.\n\n$env = $req->GetEnvironment()\nReturns the environment parameter passed to FCGI::Request.\n\n($in, $out, $err) = $req->GetHandles()\nReturns the file handle parameters passed to FCGI::Request.\n\n$isfcgi = $req->IsFastCGI()\nReturns whether or not the program was run as a FastCGI.\n",
            "subsections": []
        },
        "LIMITATIONS": {
            "content": "FCGI.pm isn't Unicode aware, only characters within the range 0x00-0xFF are supported. Attempts\nto output strings containing characters above 0xFF results in a exception: (F) \"Wide character\nin %s\".\n\nUsers who wants the previous (FCGI.pm <= 0.68) incorrect behavior can disable the exception by\nusing the \"bytes\" pragma.\n\n{\nuse bytes;\nprint \"\\x{263A}\";\n}\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Sven Verdoolaege <skimo@kotnet.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENCE": {
            "content": "This software is copyrighted (c) 1996 by by Open Market, Inc.\n\nSee the LICENSE file in this distribution for information on usage and redistribution of this\nfile, and for a DISCLAIMER OF ALL WARRANTIES.\n",
            "subsections": []
        }
    },
    "summary": "FCGI - Fast CGI module",
    "flags": [],
    "examples": [],
    "see_also": []
}