Pivotal Knowledge Base

Follow

Using your own version of PHP with vFabric Enterprise Ready Server (ERS) under Windows (1038993)

Using your own version of PHP with vFabric Enterprise Ready Server (ERS) under Windows (1038993)

Purpose

VMware vFabric Enterprise Ready Server (ERS) 4 ships with a specific version of PHP, compiled for use by the webserver via mod_php. If you would like to use a different version of PHP, more easily control the PHP extensions available, or just separate PHP execution out from your webserver, you may use mod_fcgid to link your web server to your desired PHP installation.

This article discusses a Windows environment. For information about a Linux environment, see Using your own version of PHP with vFabric Enterprise Ready Server (ERS) under Linux/Unix (2001316).

Resolution

Prerequisites

These directions were written for vFabric ERS 4.0.3 and PHP 5.3.6. Results with other versions may vary.
 
These directions refer to ERS 4 installed in C:\ers\, and an instance defined in C:\ers\servers\instance\. Modify the steps to match your own installation, if it differs.
 

Setup and Configuration

  1. Download the desired version of PHP from http://windows.php.net/download/. VMware recommends the .msi installer for the non-thread safe version

    Note: The preceding link was correct as of July 8, 2011. If you find the link is broken, provide feedback and a VMware employee will update the link.

    During installation, select the Other CGI option. This provides the php-cgi.exe wrapper required by mod_fcgid. If you have not installed it in C:\php\, modify these steps to match your own installation.

  2. Configure mod_fcgid into your instance.

    1. Add these lines to \ers\servers\instancel\conf\httpsd.conf:

      LoadModule fcgid_module "C:/ers/apache2.2/modules/standard/mod_fcgid.so"
      <IfModule mod_fcgid.c>
          AddHandler fcgid-script .php
          FcgidInitialEnv PHPRC "C:/php"
          FcgidInitialEnv PATH "C:/ers/apache2.2/bin"
          # How many requests a process should handle before recycling itself:
          FcgidMaxRequestsPerProcess 10000
          # Should match or exceed the number above
          FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 10000
          # Max PHP requests to handle at a time:
          FcgidMaxProcesses 10
          FcgidIOTimeout 120
          FcgidIdleTimeout 120
          FcgidWrapper "C:/php/php-cgi.exe" .php
          AddType application/x-httpd-php .php
      </IfModule>

    2. Add Options ExecCGI in the directory section where you want PHP to be enabled.

      Example: Add it to the <Directory "C:/ers/servers/instance/htdocs/"> section, so that it looks like this:

      Options Indexes FollowSymLinks Includes ExecCGI

    3. Remove any references to the original mod_php module. These may have been automatically created with the instance:

      <IfModule mpm_winnt.c>
          LoadFile "C:/ers/php5.2/php5ts.dll"
      </IfModule>
      LoadModule php5_module "C:/ers/apache2.2/modules/php/mod_php5.so"

      and later on

      <IfModule mod_php5.c>
          PHPINIDir "C:/ers/php5.2/"
          AddType application/x-httpd-php .php
      </IfModule>
  3. To verify that the instance works with your new PHP, create the file C:/ers/servers/instance/htdocs/info.php with exactly these contents:

    <?php
        phpinfo();
    ?>

  4. Start the instance ( bin\apache_startup.bat start). In your browser, navigate to page created on your server in step 3.

    Example: http://localhost:8080/info.php

The standard PHP Information screen is displayed. The Server API parameter is CGI/FastCGI and indicates your version of PHP (under Core).

In the Windows Task Manager, there is a php-cgi.exe process running.

In the C:/ers/servers/instance/logs/error.log file, there are [notice] lines that indicate that mod_fcgid is configured and a child process has been started.

Additional Information

For more information about configuration details, see the mod_fcgid documentation

For more information about the FastCGI standard itself, see the FastCGI web site

Note: The preceding links were correct as of July 8, 2011. If you find a link is broken, provide feedback and a VMware employee will update the link.

See Also

  • Using your own version of PHP with vFabric Enterprise Ready Server (ERS) under Linux/Unix
©VMware 2013

Comments

Powered by Zendesk