PHP SCGI + FastCGI

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.
LVL 13
WebstormAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WebstormAuthor Commented:
For the PHP SCGI version, i would like to know how to specify the port to listen, and the address to bind.
0
Richard QuadlingSenior Software DeveloperCommented:
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.



0
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.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Richard QuadlingSenior Software DeveloperCommented:
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 127.0.0.1:8002

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

aolserver
apache
apache_hooks
apache2filter
apache2handler
caudium
cgi
cli
continuity
embed
isapi
milter
nsapi
phttpd
pi3web
roxen
tests
thttpd
tux
webjames

The source can be downloaded from www.php.net and via CVS if you intend to get the latest version.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.