Sun Java System Web Server 7.0 Update 2 Administrator's Guide

Configuring PHP with FastCGI in a Hosting Environment

To configure FastCGI in virtual hosting environment, ensure that Sun specific PHP plug-in bundled with the setup is installed in the <install-dir/plugins directory. In the following example, the a mime type for PHP requests is defined and a FastCGI handler is created that accepts all PHP requests.

bash-2.05#./wadm --user=admin --password-file=pwdfile
Connected to localhost:38989
Sun Java System Web Server 7.0U2 B12/09/2007 09:02

wadm> create-mime-type  --config=php --extensions=php,php3,php4,php5 magnus-internal/php
CLI201 Command 'create-mime-type' ran successfully

wadm> create-fastcgi-handler --app-path=/ws70u2/plugins/php/bin/php 
--bind-path="\$(lc(\$urlhost))" 
--mime-type=magnus-internal/php 
--app-env=PHPRC=/$(lc(\$urlhost)),PHP_FCGI_CHILDREN=5,PHP_FCGI_MAX_REQUEST=200,LD_LIBRARY_PATH=/ws70u2/plugins/php 
--min-procs=1 --restart-interval=10 --request-retry=5 --config=php --vs=php

CLI201 Command 'create-fastcgi-handler' ran successfully

wadm> deploy-config php
CLI201 Command 'deploy-config' ran successfully

You can use the same PHP binary for all URL hosts configured in an instance. The configuration ensures that each PHP process has its own UNIX Domain Socket (UDS) same name as the URL host. The request from different hosts invokes the unique php.ini file from the app-path.


Note –

The php.in file is not mandatory to run PHP, it can be used to modify the default settings.


For more information, see the CLI reference create-fastcgi-handler(1)