Re: PHP and a general problem understanding fastcgi

David Birnbaum <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
On Tue, 12 Jul 2005, Benjamin Podszun wrote:

> Thanks for sharing that experience..
>
>> Here's a sample vhost configuration for you:
>> 
>>  User blah
>>  Group blahgrp
>>  FastCgiServer /export/httpd/DOMAINS/blah.com/cgi-bin/php -port 9050
>>  AddHandler php-fastcgi .php
>>  <Location /cgi-bin/php>
>>    SetHandler fastcgi-script
>>  </Location>
>>  Action php-fastcgi /cgi-bin/php
>> 
>> That creates the necessary hookup for .php files, and runs PHP stuff via 
>> suexec as blah/blahgrp.  You then have this file:
>> 
>>  #!/bin/sh
>>  PHPRC="/usr/local/etc/php/php-blah"
>>  export PHPRC
>> 
>>  PHP_FCGI_CHILDREN=4
>>  export PHP_FCGI_CHILDREN
>>  exec /opt/php/4.3.4/bin/php
>> 
>> which controls that particular instance.
>
> Nice example and helps quite a lot, thanks. But some questions remain:
> - What is the port for? Who connects to that port?

The port is if you want to have FastCgiExternalServer directives - which allows 
you to have other vhost httpd's connect to a single PHP instance.  For example, 
I actually have five domains for this particular user.  One of them has this:

   FastCgiServer /export/httpd/DOMAINS/blah.com/cgi-bin/php -port 9050

And the other four have this:

   FastCgiExternalServer /export/httpd/DOMAINS/blah1.com/cgi-bin/php -host localhost:9050
   FastCgiExternalServer /export/httpd/DOMAINS/blah2.com/cgi-bin/php -host localhost:9050
   FastCgiExternalServer /export/httpd/DOMAINS/blah3.com/cgi-bin/php -host localhost:9050
   FastCgiExternalServer /export/httpd/DOMAINS/blah4.com/cgi-bin/php -host localhost:9050

So rather than have another four instances, one does all of the work.

> - How is the FastCgiServer connected to the AddHandler? I mean: Couldn't you 
> define multiple servers? How do you distinguish which server you want to use 
> for .php files? To clarify my question:
>
> FastCgiServer /export/httpd/DOMAINS/blah.com/cgi-bin/php -port 9050
> FastCgiServer /export/httpd/DOMAINS/blah2.com/cgi-bin/php -port 9051
> AddHandler php-fastcgi .php
>
> Is the above possible? How can I connect a specific server to a filetype?

Ah...it's done in the context of the vhost.  So, you can only have one PHP 
FastCgi handler per suffix per vhost.

> - What happens if the php handler die? Do I deliver source in that case, as 
> apache defaults to without mod_php?

The handler is restarted by FastCGI automatically if it is killed or crashes.

David.

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.