From owner-freebsd-questions@FreeBSD.ORG Wed Feb 22 05:02:54 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 417AF106566B for ; Wed, 22 Feb 2012 05:02:54 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by mx1.freebsd.org (Postfix) with ESMTP id DCB208FC08 for ; Wed, 22 Feb 2012 05:02:53 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S04Ls-00045R-0C for freebsd-questions@freebsd.org; Wed, 22 Feb 2012 06:02:52 +0100 Received: from pool-173-79-99-96.washdc.fios.verizon.net ([173.79.99.96]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Feb 2012 06:02:51 +0100 Received: from nightrecon by pool-173-79-99-96.washdc.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 22 Feb 2012 06:02:51 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Michael Powell Date: Wed, 22 Feb 2012 00:03:09 -0500 Lines: 73 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: pool-173-79-99-96.washdc.fios.verizon.net Subject: Re: apache22 + php5 (package not ports) ~ spawn-fcgi ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: nightrecon@hotmail.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 05:02:54 -0000 alexus wrote: > I dont think you really grasping what I was asking.. > I am aware that I can build from source, yet I'm trying to stay away > from that route due to a lot of overhead going forward... > I'm also aware that php5 or actually apache22 doesn't come with > mod_php as well, and as alternative I'm willing to go spawn-fcgi route > instead, and this is what I'm interested in. > I'm looking for some blog/howtos of people already done it on freebsd > and not just a general fastcgi.com site :) > So, if anyone have an experience or know a good resources that may be > useful for me at this point of time, I'd highly appreciate if you can > post it here. You do not need spawn-fcgi wrt to PHP. I install software by compiling through the ports system, as it is just so much more maintainable in the long run. Also, you are more able to select build options which are better suited to your needs and environment. I have built Apache outside the ports tree in the long-ago past, so I do understand how. It's just there really is not a great reason to do so. In my case, I utilize the apache-event MPM in conjunction with FastCGI. Originally I began with mod_fcgi, and it seemed to work well. When I learned that mod_fastcgi was supposed to work better with PHP-FPM I switched to it when I made the change to PHP-FPM. PHP-FPM runs on it's own at boot and has it's own startup scripts. You can set the options to do this when you build the base PHP port by choosing WITH_CLI=true, WITH_CGI=true, WITH_FPM=true and you will not need spawn- fcgi; PHP-FPM supplies this functionality [e.g 'long-running process'] by design. Also there is a .conf you can use to adjust your PHP CGI pools in a much more granular way than with spawn-fcgi. Irregardless of which MPM you run Apache with, the next step is to connect Apache through mod_fastcgi to these running instance(s) of PHP. Here is an example from httpd.conf for this: [...] LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so [...] Alias /php-cgi /usr/local/www/fastcgi/php-cgi #FastCGIExternalServer /usr/local/www/fastcgi/php-cgi -flush -host 127.0.0.1:9000 FastCGIExternalServer /usr/local/www/fastcgi/php-cgi -flush -socket /tmp/php- fm.sock AddType application/x-httpd-php .php Action application/x-httpd-php /php-cgi Order deny,allow Deny from all Order allow,deny Allow from all Notice I use a socket, and this socket is configured in the php-fpm.conf. The normal default is to use the TCP loopback. This also is probably not the best config available, but it supplies my very basic needs. If you are trying to set up Apache with mod_fastcgi, go with PHP-FPM as your CGI version of the PHP port build (set in the make config options) and it will be easy. IMHO this is a better way to go than spawn-fcgi, especially wrt to PHP specifically. --Mike