Re: PHP and a general problem understanding fastcgi
Benjamin Podszun <ben-/[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
David Birnbaum wrote: > We use php/FastCGI extensively - it's great for a number of reasons: > > 1. You can control the number of instances of PHP per vhost very > easily, which prevents CPU thrash. > 2. The memory usage of the server is reduced because httpd stays very > light. > 3. Each PHP instance runs as the correct user/group which reduces > security exposure. 1 and 3 are my friends here.. > Our bench testing shows straight PHP is about the same in other mod_php > or FastCGI. However, I find overall web performance to be slightly > higher because plenty of httpd's stay uninvolved with PHP and can handle > images/static pages while the PHP instances crunch away independently. 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? - 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? - What happens if the php handler die? Do I deliver source in that case, as apache defaults to without mod_php? Thanks a lot for your help so far, Ben ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/