Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1514
  • Last Modified:


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.
  • 3
  • 3
1 Solution
WebstormAuthor Commented:
For the PHP SCGI version, i would like to know how to specify the port to listen, and the address to bind.
Richard QuadlingSenior Software DeverloperCommented:
All of PHP can be downloaded from www.php.net

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.

WebstormAuthor Commented:
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.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Richard QuadlingSenior Software DeverloperCommented:
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!
Richard QuadlingSenior Software DeverloperCommented:
The phpsrc/sapi directory contains the following sub-directories ...


The source can be downloaded from www.php.net and via CVS if you intend to get the latest version.
WebstormAuthor Commented:
PHP doesn't still implements the SCGI interface ( http://python.ca/nas/scgi/protocol.txt ), so I have to use FastCGI.

Thanks for your help.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now