WebFaction
Community site: login faq

Hello,

First, I would like to say that I am a complete newbie with fastcgi and lighttpd. I am using Horde under lighttpd and php 5.3 (fastcgi).

Under a default configuration of fastcgi:

fastcgi.server  = ( ".php" =>
                   ( "localhost" =>
                    (
                     "socket" => "/home/dgraziotin/php-fastcgi.socket",
                     "bin-path" => "/home/php-cgi/php53.fcgi -c /home/dgraziotin/webapps/lighttpd/conf/php.ini",
                     "broken-scriptfilename" => "enable",
                    )
                    )
                   )

Everything works fine but it creates 8 php53.fcgi processes, that consume too much memory (about 150MB).

If I ever try to limit the number of processes, the website simply hangs after a couple of minutes.

For example, the following configuration:

fastcgi.server  = ( ".php" =>
                   ( "localhost" =>
                    (
                     "socket" => "/home/dgraziotin/php-fastcgi.socket",
                     "bin-path" => "/home/php-cgi/php53.fcgi -c /home/dgraziotin/webapps/lighttpd/conf/php.ini",
                     "broken-scriptfilename" => "enable",
                     "max-procs" => 1,
                     "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "1",
                        "PHP_FCGI_MAX_REQUESTS" => "500"
                     ),
                    )
                    )
                   )

creates only 2 php53.fcgi processes (a father and a child, if I understand) that consume about 50MB of memory. I would be happy with that. After 3-5 minutes of usage, the site just hangs and tries to load a page for an infinite amount of time. No errors are shown anywhere.

Does anybody have some hints for me?

Cheers

asked 01 May '12, 04:56

dgraziotin
123
accept rate: 0%

edited 01 May '12, 05:12

Instead of using /home/php-cgi/php53.fcgi with the environment variable in lighttpd configuration, can you try with just /home/php-cgi/php53-fcgi2.fcgi?

(01 May '12, 05:31) neeravk

I copied php53-fcgi2.fcgi in my home to add the -c switch (load the custom php.ini). I deleted max-procs and PHP_FCGI_CHILDREN in my lighttpd.conf file and loaded the new php53-fcgi2.fcgi file. Unfortunately, this one creates 8x php53.fcgi processes that consume 170MB of memory. It looks like it is behaving as with a default configuration

(01 May '12, 06:36) dgraziotin

Here are my thoughts after playing around with the various configurations.

  • It does not matter whether I use php53.fcgid or php54.fcid, the problem is still here.
  • At least with lighttpd, I have a better control to use /home/php-cgi/php53.fcgi and tune max-procs +PHP_FCGI_CHILDREN from lighttpd configuration, instead of using /php53-fcgi<x>.cgi
  • The problem occurs only when using a single php father process (i.e., "max-procs" => 1)

Therefore, the best solution for me is to use "max-procs" => 2 and "PHP_FCGI_CHILDREN" => "1" to limit resource usage.

This is the configuration I use:

fastcgi.server  = ( ".php" =>
                   ( "localhost" =>
                    (
                     "socket" => "/home/dgraziotin/php-fastcgi.socket",
                     "bin-path" => "/home/php-cgi/php53.fcgi -c /home/dgraziotin/webapps/lighttpd/conf/php.ini",
                     "broken-scriptfilename" => "enable",
                     "max-procs" => 2,
                     "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "1",
                        "PHP_FCGI_MAX_REQUESTS" => "500"
                     ),
                    )
                    )
                   )
permanent link

answered 01 May '12, 11:52

dgraziotin
123
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×11
×9
×4
×3

question asked: 01 May '12, 04:56

question was seen: 5,372 times

last updated: 01 May '12, 11:52

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM