#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
#

# 
# Cause PHP5 to work with Apache pre-fork MPM(32-bit) only.
# Load this module only if not loaded already
#
<IfDefine !64bit>
<IfModule prefork.c>
<IfModule !mod_php5.c>
LoadModule php5_module libexec/mod_php<<VERSION>>.so
</IfModule>
</IfModule>
</IfDefine>

<IfModule mod_php5.c>
#
# Cause the PHP interpreter handle files with a .php extension.
#
AddHandler application/x-httpd-php .php5
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .php5s
AddHandler application/x-httpd-php-source .phps

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
DirectoryIndex index.php5
</IfModule>

<IfModule !mod_php5.c>
<IfModule mod_fcgid.c>
#
# Cause the PHP interpreter to be invoked via FastCGI to handle files 
# with a .php extension.
#
FcgidWrapper "/usr/php/<<VERSION>>/bin/php-cgi" .php
FcgidWrapper "/usr/php/<<VERSION>>/bin/php-cgi" .php5

FcgidCmdOptions /usr/php/<<VERSION>>/bin/php-cgi \
  InitialEnv PHP_FCGI_MAX_REQUESTS=10000 \
  InitialEnv PHP_FCGI_CHILDREN=0 \
  MaxRequestsPerProcess 10000

# Match .php or .php5 files and enable execution via mod_fcgid
<FilesMatch "\.php5?$">
  SetHandler fcgid-script
  Options +ExecCGI
</FilesMatch>

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
DirectoryIndex index.php5
</IfModule>
</IfModule>
