From owner-freebsd-questions@FreeBSD.ORG Sat May 8 09:06:58 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1AB91065672 for ; Sat, 8 May 2010 09:06:58 +0000 (UTC) (envelope-from joe@netmusician.org) Received: from mail.netmusician.org (dorian.netmusician.org [66.244.95.101]) by mx1.freebsd.org (Postfix) with ESMTP id 4AEF08FC1A for ; Sat, 8 May 2010 09:06:57 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by mail.netmusician.org (Postfix) with ESMTP id 5D9D2B8F4; Sat, 8 May 2010 05:06:39 -0400 (EDT) X-Virus-Scanned: amavisd-new at netmusician.org Received: from mail.netmusician.org ([127.0.0.1]) by localhost (dorian.netmusician.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0c-8xNeOuzU6; Sat, 8 May 2010 05:06:39 -0400 (EDT) Received: from Shakti.local (c-67-176-145-181.hsd1.in.comcast.net [67.176.145.181]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.netmusician.org (Postfix) with ESMTPSA id 4ED6FB8CB; Sat, 8 May 2010 05:06:38 -0400 (EDT) Message-ID: <4BE5299D.9010309@netmusician.org> Date: Sat, 08 May 2010 05:06:37 -0400 From: Joe Auty User-Agent: Postbox 1.1.4 (Macintosh/20100408) MIME-Version: 1.0 To: Michael Powell References: <4BE472EC.5060808@netmusician.org> In-Reply-To: X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org Subject: Re: php-cgi 5.3.x and APC 3.1.3 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 09:06:59 -0000 Michael Powell wrote: > Joe Auty wrote: > > >> Hello, >> >> I'm trying to get the APC user cache to work for me... It works with PHP >> installed as an Apache module, but not as a CGI. >> > > I run Apache with the event mpm. This may, or may not be wise, but I've been > doing it for a while now and had no problems with it. I also use Xcache so > my comments are not APC specific. > > Since not all of PHP is considered thread safe it is not advisable to run > PHP on the event mpm as it is a threaded version. The way around this is to > not use mod_php but instead run mod_fcgid.so so PHP can be run as a FastCGI. > > The problem with mod_fcgid for me is that it doesn't work with the APC cache... From http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/ : > Both mod_fcgid and mod_fastcgi can be told to limit the number of PHP > processes to 1 per user. The PHP process can then be told how many > children to spawn. Unfortunately mod_fcgid will only send one request > per child process. The fact that PHP spawns its own children is > ignored by mod_fcgid. If we use mod_fcgid with our setup, we can only > handle one concurrent PHP request. This is not good. A long running > request could easily block multiple smaller requests. >> I understand that in order to get this to work one has to add a: >> >> >>> FastCgiConfig -maxClassProcesses 1 >>> >> to their Apache config (for those that use Apache). I've done this, but >> I'm still not seeing any evidence that the user cache is working. >> > > This I do not know about and have never seen, but I do recall floundering > around in the beginning and being very confused by the difference between > exec'ing PHP code as a CGI as opposed to running it in a FastCGI process. > There is a huge difference, with the FastCGI being many times faster. > > I'm now convinced that FastCGI is running since I'm seeing FastCGI signatures in my logs... I think I've been able to get everything to work though, but I can see why this article above says that performance of what I'm doing (upload progress bar) is not as good. Oh well, I imagine that the general improvements in using FastCGI and PHP CGI will offset this difference. More below... > > In phpinfo(); you can see this: > > Server API CGI/FastCGI > > I'm seeing that... Thanks for posting your example httpd.conf config, it was useful to make sure I had all of my bases covered! > My options for PHP build: > > WITH_CLI=true > WITH_CGI=true > WITH_APACHE=true > WITHOUT_DEBUG=true > WITH_SUHOSIN=true > WITH_MULTIBYTE=true > WITHOUT_IPV6=true > WITHOUT_MAILHEAD=true > WITH_REDIRECT=true > WITH_DISCARD=true > WITH_FASTCGI=true > WITH_PATHINFO=true > > Also keep in mind that any time PHP is rebuilt APC will need to be rebuilt > too. > > Thanks! It looks like the with_fastcgi option has been removed from PHP 5.3's make config option list (no sign of it in the Makefile either), but it appears that building with CGI support also builds it with FastCGI support. I'm assuming this FastCGI support is generic and supports both mod_fastcgi and mod_fcgi? This is the confusing part, I'm sure someday I'll want to upgrade to mod_fcgi as soon as it supports the APC (or some other) cache mechanism which I count on for upload progress bars. Thanks again for your help! -- Joe Auty, NetMusician NetMusician helps musicians, bands and artists create beautiful, professional, custom designed, career-essential websites that are easy to maintain and to integrate with popular social networks. www.netmusician.org joe@netmusician.org