lighttpd forum lighty > APC Problem

Posted by Ingo Fabbri
on 22.06.2006 22:59
Hi

There is a problem with my apc installation.

apc 3.0.10
lighty 1.4.11
php 5.1.4

it seems that apc isn't caching anything in php-fcgi mode.
just for testing that apc is generally working, i tried apache instead
of lighty  . with apache it works great - it successfully creates a
cache.
now i'm running lighty again, sure.

just look here and judge for yourself.
http://85.88.7.141/apc.php

especially take a look at the values of
Start Time & Uptime!!!!!!!
It seems that by every refresh these values reset. -> the same for the
cache!!!!!! (EDIT: maybe for every single php-script-execution a new 
php-thread is generated and so apc is started at execution-start and 
also terminated again at excution-end of the script???)

could it be, that apc isn't woking with lighty's fcgi-module?
or have i just forgot to configure some "magic" in the config?

fastcgi.server = (
  ".php" => ((
    "bin-path" => "/usr/bin/php5-cgi",
    "socket" => "/tmp/lighttpd_php5.socket",
    "min-procs" => 2,
    "max-procs" => 2,
    "bin-environment" => (
      "PHP_FCGI_CHILDREN" => "4",
      "PHP_FCGI_MAX_REQUESTS" => "250"
    ),
    "bin-copy-environment" => (
      "PATH", "SHELL", "USER"
    ),
    "broken-scriptfilename" => "enable"
  ))
)

i have a theory why it may not work, but let's see what you guys suggest
me to do. :-)

THANKS
Ingo
Posted by Yejun Yang
on 23.06.2006 18:32
Ingo Fabbri wrote:
>     "min-procs" => 2,
>     "max-procs" => 2,

Both should be set to 1.
Posted by Ingo Fabbri
on 23.06.2006 19:35
Yejun Yang wrote:
> Ingo Fabbri wrote:
>>     "min-procs" => 2,
>>     "max-procs" => 2,
> 
> Both should be set to 1.

nop, doesn't change apc behaviour. maybe all lighty+apc users should
check apc's webinterface (apc.php) if apc is working how it should
do....

EDIT:
new solution-theory:
enabling mmap in apc. i'll report later if it worked

EDIT:
compiled apc myself with --enable-apc --enable-apc-mmap
but it still doesn't work!!!

http://85.88.7.141/info.php
http://85.88.7.141/apc.php

i'm very close to believe, that apc has never worked with lighttpd (ergo
with php fcgi) in
the past - for anybody who claimed: "oh my god!!! it improved speed
100000 times!!!!". don't wanna call you all "liars", but please show me
the output of your apc.php - prove it!

EDIT:
now i grabbed the newest cvs and compiled it.....no it still doesn't
work!

EDIT:
seems like i have to try xcache - definitely
working with lighttpd!
Posted by festzeit.ch (Guest)
on 24.06.2006 14:05
Ingo Fabbri wrote:
> i'm very close to believe, that apc has never worked with lighttpd (ergo
> with php fcgi) in
> the past - for anybody who claimed: "oh my god!!! it improved speed
> 100000 times!!!!". don't wanna call you all "liars", but please show me
> the output of your apc.php - prove it!


APC Version	3.0.10
PHP Version	5.1.2
APC Host	www.festzeit.ch
Server Software	lighttpd/1.4.11
Cached Files	31
Hits	8257944
Misses	1802
Request Rate	71.60 cache requests/second
Time To Live	0
Shared Memory	1 Segment(s) with 32.0 MBytes
Start Time	2006/06/23 06:00:27

;)
Posted by Ingo Fabbri
on 24.06.2006 14:42
festzeit.ch wrote:
> APC Version	3.0.10
> PHP Version	5.1.2
> APC Host	www.festzeit.ch
> Server Software	lighttpd/1.4.11
> Cached Files	31
> Hits	8257944
> Misses	1802
> Request Rate	71.60 cache requests/second
> Time To Live	0
> Shared Memory	1 Segment(s) with 32.0 MBytes
> Start Time	2006/06/23 06:00:27
> 
> ;)

hm, "cached files" makes me believe that it could be really possible
that apc "could" work with lighttpd.
BUT, maybe you could take a quick glance at the following site:
http://85.88.7.141/apc.php
uptime is always 0 and start-time is always changing to the 
"last-site-refresh" time!!!!!

mfg

PS:
maybe you can post a short snip out of your fastcgi-config?
Posted by Ingo Fabbri
on 25.06.2006 12:42
problem solved.
all i had to do is, starting php-cgi by myself - via a shell-script
lighttpd's fcgi interface is then only working with the socket.

see
fastcgi.server = ( ".php" =>
                       (
                          ( "socket" => "/tmp/php-fcgi.socket",
                            "check-local" => "disable",
                            "broken-scriptfilename" => "enable"
                          )
                        )
                      )

that is workig for me. everything else....not.

the following wasn't working - i assume that lighttpd reloads php-fcgi 
every
request and so the apc-cache has been build up everytime by zero.

fastcgi.server = (
  ".php" => ((
    "bin-path" => "/usr/bin/php5-cgi",
    "socket" => "/tmp/lighttpd_php5.socket",
    "min-procs" => 1,
    "max-procs" => 1,
    "bin-environment" => (
      "PHP_FCGI_CHILDREN" => "4",
      "PHP_FCGI_MAX_REQUESTS" => "250"
    ),
    "bin-copy-environment" => (
      "PATH", "SHELL", "USER"
    ),
    "broken-scriptfilename" => "enable"
  ))
)

anyone out there who can really prove that this config, which isn't
working for me, is successfully running on his/her server?

mfg
Posted by kl (Guest)
on 01.05.2008 21:26
APC is working for me with similar set up (I haven't compared config 
line-by-line, but I've got max-procs=1 and PHP_FCGI_CHILDREN=8).

You have to enable CGI mode for APC in php.ini.