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

Running FastCGI Enabled PHP Application in Remote Mode

You can run FastCGI enabled PHP in remote mode and configure Sun Java System Web Server. This enables the Web Server to pass requests to the remote PHP engine.

ProcedureTo Run FastCGI Enabled PHP Application

  1. Run FastCGI enabled PHP.


    $ php -b <hostname>:<port> &

    For example:


    $ php -b localhost:4321 &

    Note –

    You can check whether or not the PHP you are using is FastCGI-enabled by running the command:


    $ php -v

    PHP 5.2.5 (cgi-fcgi) (built: May  8 2008 12:50:19)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

    In the output, look for cgi-fcgi to confirm.


  2. Configure the Sun Java System Web Server using CLI.

    For example, a Web Server instance named test is created.

  3. Using the CLI, execute the following command:


    wadm> create-fastcgi-handler --config=test --vs=test
     --uri-pattern=/php/* --role=responder --bind-path="localhost:4321"
    wadm> deploy-config test

    A FastCGI handler with the role as Responder is created.

  4. Restart your instance.


    wadm> restart-instance --config=test localhost

    After completing the configuration, you can check if the requests from Web Server are being forwarded to the remote PHP engine.

    1. Place the below sample PHP script in the php subdirectory of your instance docroot, that is, <instance-dir>/docs_directory


      info.php:
      <?php
      phpinfo();
      ?>
    2. Access the remote PHP engine URL: http://localhost:<webserverport>/php/info.php to verify the status of your request.