WebFaction
Community site: login faq

I would like to use PHP with FastCGI as described in the documentation. But my site is very busy, and 6 child processes isn't enough. How can I configure my app to use more processes?

asked 22 Aug '13, 01:18

SethKinast
258211
accept rate: 54%


Because Webfaction only provides handlers for 1-6 child processes, you'll need to create your own handler script based off the ones found in /home/php-cgi/ on your server.

In the root directory of your app, place two files. In this example we'll be using PHP 5.4 and creating 12 child processes.

php54-fcgi-custom.fcgi

#!/bin/sh

PHPRC="/usr/local/lib/php54"
export PHPRC
export PHP_FCGI_CHILDREN=12
export PHP_FCGI_MAX_REQUESTS=500
exec /home/php-cgi/php54.fcgi

.htaccess

<FilesMatch \.php$>
    SetHandler php54-fcgi-custom
    Action php54-fcgi-custom /php54-fcgi-custom.fcgi
</FilesMatch>

Make sure your .fcgi handler is set executable:

chmod +x php54-fcgi-custom.fcgi

Now, load your app and you should see 12 php54.fcgi processes appear in the output of ps -u <username> -o etime,pid,command | grep php54.fcgi

permanent link

answered 22 Aug '13, 01:18

SethKinast
258211
accept rate: 54%

edited 22 Aug '13, 13:38

As per a recent support ticket, thought this was useful to share as it took several iterations to find something that worked.

(22 Aug '13, 01:18) SethKinast
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:

×262
×11

question asked: 22 Aug '13, 01:18

question was seen: 8,744 times

last updated: 22 Aug '13, 13:38

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