Toolserver:Switchboard

switchboard is a daemon that allows you to use FastCGI PHP instead of CGI PHP for your PHP scripts. The problem with CGI PHP is that every request creates a new PHP interpreter, which is slow, and for heavily-used scripts, causes a lot of extra load on the system. FastCGI re-uses the same PHP interpreter for several requests, which is much faster.

Unfortunately, Apache's mod_fastcgi has issues with long-scripts (those longer than around 30 seconds). If you have such long-running tools, you might not want to use FastCGI for those. Fortunately, FastCGI can be enabled for particular files or directories without affecting others. Problems with long-running scripts should now be fixed.

For all files or an entire directory
Create a .htaccess file which contains:

AddHandler php-fastcgi .php

If you put this in a particular directory, it will only apply to that directory and directories underneath it. If you put it in your top-level public_html, it will apply to all your PHP scripts.

For specific files
Method #1: Rename each file from .php to .phpf. Then change the URL from http://toolserver.org/~jsmith/mytool.php to http://toolserver.org/~jsmith/mytool.phpf. Only files named .phpf will use switchboard; others will use standard CGI PHP.

Method #2: Similar to method for all files or an entire directory. Add the following to your .htaccess file:

 AddHandler php-fastcgi .php 

This will enable the fastcgi handler for mytool.php. Instead of a full file names, wildcard patterns or regular expressions may also be used, see.

Method #3: Rename the file as in #1. Then create a .htaccess</tt> file that contains: RewriteEngine On RewriteBase /~jsmith/path/to/tool RewriteRule ^mytool.php$ mytool.phpf [PT,L,QSA]

This will allow the same URL (http://toolserver.org/~jsmith/path/to/tool/mytool.php) to keep working.