Posted on 2006-04-01
Last Modified: 2013-12-13
Hi experts,

Where can I download the SCGI version and the FastCGI version of PHP for Windows ?
And how should I start it (command line options ...) ?

I'm developping a web server, and I already tried running PHP as CGI only, but it's a bit slow.
I already developped the SCGI interface, and will make the more complicated FastCGI interface later.
Question by:Webstorm
    LVL 13

    Author Comment

    For the PHP SCGI version, i would like to know how to specify the port to listen, and the address to bind.
    LVL 40

    Expert Comment

    All of PHP can be downloaded from

    This is THE official repository of PHP.

    You can also download the source to PHP here as well.

    And yes, CGI is not ideal.

    The php executable is automaticallly fastcgi (I think).

    <03/04/2006  8:14:25 C:\>php-cgi -v
    PHP 5.1.3-dev (cgi-fcgi) (built: Feb 20 2006 00:28:46)
    Copyright (c) 1997-2006 The PHP Group
    Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
        with Zend Extension Manager v1.0.10, Copyright (c) 2003-2006, by Zend Technologies
        with Zend Optimizer v3.0.0-Beta2, Copyright (c) 1998-2006, by Zend Technologies

    Ideally, the ISAPI interface is the best way to go for non IIS.

    I'm a windows user and I've used Sambar Server with ISAPI module for nearly 5 years (PHP4 and PHP5). I've not had any problems with it.

    And I've added the Zend Optimizer.

    Very stable.

    For me, the main disadvantage of using an executable (CGI/FCGI) is the lack of persistent database connections. This is VERY important if you have a DB orientated website.

    LVL 13

    Author Comment

    Hi RQuadling,

    Thanks for your suggestion but I can't use ISAPI because I'm using Java.

    >> For me, the main disadvantage of using an executable (CGI/FCGI) is the lack of persistent database connections.
    I understand this point for CGI. But FastCGI or SCGI executables are only started once, so persistent database connections should be possible.
    Also the main advantage of using external executable is executable can crash without crashing the web server itself which can restart the executable when necessary.
    LVL 40

    Expert Comment

    OK. I'm unfamiliar with "SCGI". I don't recall ever seeing this SAPI.

    But the binding bit. From the README.FastCGI file in phpsrc/sapi/cgi

    Running the FastCGI PHP module

    There are two ways to run the resulting 'php' binary after the fastcgi
    version has been built:

    1) Configure your web server to run the PHP binary itself.

    This is the simplest method, obviously you will have to configure your
    web server appropriately. Some web servers may also not support this method,
    or may not be as efficient.

    2) Run PHP separately from the web server.

    In this setup, PHP is started as a separate process entirely from the web
    server. It will listen on a socket for new FastCGI requests, and deliver
    PHP pages as appropriate. This is the recommended way of running PHP-FastCGI.
    To run this way, you must start the PHP binary running by giving it an IP
    and a port number to listen to on the command line, e.g.:

        ./php -b

    The above line is the recommended way of running FastCGI.  You usually
    want the FastCGI server to provide services to the localhost, not
    everyone on the Internet.

    If your web server sits on a remote host, you can make FastCGI listen
    on all interfaces:

        ./php -b :8002
        ./php -b "*:8002"

    Note that hostnames are not supported.

    You must also configure your web server to connect to the appropriate port
    in order to talk to the PHP FastCGI process.

    The advantage of running PHP in this way is that it entirely separates the
    web server and PHP process, so that one cannot disrupt the other. It also
    allows PHP to be on an entirely separate machine from the web server if need
    be, you could even have several web servers utilising the same running PHP
    process if required!
    LVL 40

    Accepted Solution

    The phpsrc/sapi directory contains the following sub-directories ...


    The source can be downloaded from and via CVS if you intend to get the latest version.
    LVL 13

    Author Comment

    PHP doesn't still implements the SCGI interface ( ), so I have to use FastCGI.

    Thanks for your help.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now