fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# CDDL HEADER START
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# The contents of this file are subject to the terms of the
55c79512242fd281202cd57ca18defac696440f5kess# Common Development and Distribution License (the "License").
55c79512242fd281202cd57ca18defac696440f5kess# You may not use this file except in compliance with the License.
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd# See the License for the specific language governing permissions
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd# and limitations under the License.
2e545ce2450a9953665f701bb05350f0d3f26275nd# When distributing Covered Code, include this CDDL HEADER in each
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# If applicable, add the following below this CDDL HEADER, with the
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd# fields enclosed by brackets "[]" replaced with your own identifying
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd# information: Portions Copyright [yyyy] [name of copyright owner]
3f08db06526d6901aa08c110b5bc7dde6bc39905nd# CDDL HEADER END
726b11c595edf0b0b71d0d39a2bc9d912c0ee4b5nd# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd# Helper functions
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd echo "Usage: This script will update a given Web Server 7 instance's configuration"
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen echo " --installroot : Top level Sun Web Server 7 installation location. "
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd echo " --instancename : Name of Web Server instance (https-php) which should"
ec1d455940a366b63e1cce2f442a445347394a90nd echo " --sapi : How should PHP runtime be loaded within Web Server 7"
5b10fd3977e6dfff19afe770e612e276962f7950nd until [ $# -eq 0 ]
cf60fc8ad0f3a8f4b08351a2a3e346e0662af010nd # Get user response on Web Server 7 installation location and instance name.
6c4ef4a72d9897e53365b94103f4bd819fd0d3acnd echo -n "Enter your Web Server instance name to configure with PHP runtime: "
55c79512242fd281202cd57ca18defac696440f5kess while [ 0 ]; do
4b311579b2c8aebac85fb7cb8ac89e6c37b4bc1asf echo -n "How you would like Sun Web Server 7 to load PHP engine (fastcgi|nsapi) [fastcgi]: "
623eebe956d9c2d6d073ed3eae855b56030b40e9noodl if [ -n "$sapi" ] && [ $sapi = "fastcgi" -o $sapi = "nsapi" ]; then
65a611af7093423efb91e5794b8887a527d4cf63trawick if [ ! -d "$install_root" ] || [ ! -x "$install_root/lib/webservd" ]; then
42af92a661a06b3cebc88d585aad75064a309d51nd echo "Warning: Unable to find valid Web Server installation under $install_root"
42af92a661a06b3cebc88d585aad75064a309d51nd echo "Please try again by providing a valid Web Server 7 installation location."
55c79512242fd281202cd57ca18defac696440f5kess if [ ! -d "$install_root" ] || [ ! -x "$install_root/lib/webservd" ]; then
55c79512242fd281202cd57ca18defac696440f5kess echo "Warning: Unable to find valid Web Server installation under $install_root"
0203b896e484dfb877111aceffb812401d0f216and echo "Please try again by providing a valid Web Server 7 installation location."
55c79512242fd281202cd57ca18defac696440f5kess if [ -n "$sapi" ] && [ $sapi != "fastcgi" -a $sapi != "nsapi" ]; then
f6066dc0a6ad0432b74774e290c04c3cc4aa2dafrbowen echo "Error: Invalid SAPI option is provided.Valid SAPI argument is either 'fastcgi' or 'nsapi'"
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin echo "Please try again by providing a valid SAPI as argument."
55c79512242fd281202cd57ca18defac696440f5kess if [ ! -f $temp_file ]; then
1ce7f356a70d1d9961ec315c212e2f83a1452456nd total_line=`wc -l $PROGRAM_NAME | awk '{print $1}' 2>/dev/null`
55c79512242fd281202cd57ca18defac696440f5kess if [ ! -d "${WS_INSTANCEROOT}/${instance_name}" ]; then
6c4ef4a72d9897e53365b94103f4bd819fd0d3acnd echo "Warning: Unable to find instance:'$instance_name' under $WS_INSTANCEROOT"
2704de98885368683621b01c8f8f4e4b01557611takashi echo " Please try again by providing a valid instance name."
d2b809e5d72658bff23819d8b77f20e4939af541nd ln -sf "<<INSTALL_DIR>>/nsapi/libphp5.so" "$install_root/plugins/webstack-php/libphp5.so"
5effc8b39fae5cd169d17f342bfc265705840014rbowen ${WS_PERL}/perl -I ${WS_PERL} -I ${WS_PERL}/lib -I ${WS_PERL}/lib/site_perl $temp_file \
27d778df0b517e1578f907d2e51eb961cd8ee5fbjim -installroot=${WS_INSTALLROOT} -instanceroot=${WS_INSTANCEROOT} -instancename=$instance_name \
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd -phpconfroot="${PHPCONFROOT}" -phpmodulesconfroot="${PHPCONFROOT_SCANDIR}"
240e1b440b19476ecaa4aa9ff8d79afef74cb14and if [ $status -eq 0 ]; then
240e1b440b19476ecaa4aa9ff8d79afef74cb14and if [ -f $temp_file ]; then
1d980e5489836e977ba59b419e27b0ec875c4bd3takashi elif [ $status -ne 0 ]; then
e5ce3ac0e9b720c0fa23782e29168a0810697fdetakashi echo "Unable to successfully setup PHP within Web Server 7"
4126704c4950bfd46d32ad54e3b106ac6d868a73sf#-------------------------------------------------------------------------------
4ed26c413f67a5aae20b95909828f30bb5dc2286poirier# Global variables.
50cb7e2b30597f481fee57bac945190f06ebcc58jorton# This below line need to point to the start of embedded perl script.
f772e8f448c223e5ea306f1bf92d97d968f972d5jimecho "This script will update a given Web Server 7 instance's configuration"
fac8c35bfb158112226ab43ddf84d59daca5dc30ndecho "files to be able to execute PHP scripts."
1de1266f0ea387d6373be8415745dfd2ab876341jim# Verify if the program is called with necessary arguments.
1de1266f0ea387d6373be8415745dfd2ab876341jimif [ -n "$1" ]; then
5effc8b39fae5cd169d17f342bfc265705840014rbowen # Invoked with no arguments. Try interactive.
55c79512242fd281202cd57ca18defac696440f5kess#---------------------EOF-------------------------------------------------------
4044e4b6cb07cf7fa8e90676fafffe543c1d439bjim# Helper Script to configure PHP runtime environment within Web Server 7
# Migrate obj.conf file to php 1.1
my $objConfFile = shift;
my $pContents = shift;
my $tmpObjConfStatus = 1;
return undef;
my $update_reqd = undef;
local *TMPOBJ;
$pContents->[$i] = $tmp;
$update_reqd = 1;
# Parse the server.xml and get all the mime files and object files
my $serverXml = "$INSTANCE_ROOT/$INSTANCE_NAME/config/server.xml";
for (my $mimeTypescounter = 0; ${virutalServerElement}->{"mime-file"}->[$mimeTypescounter]; $mimeTypescounter++) {
for (my $objectFilecounter = 0; ${virutalServerElement}->{"object-file"}->[$objectFilecounter]; $objectFilecounter++) {
#Default is mime.types
push (@$MIME_TYPES_FILES, "$INSTANCE_ROOT/$INSTANCE_NAME/config/mime.types");
#Default is obj.conf
push (@$OBJ_CONF_FILES, "$INSTANCE_ROOT/$INSTANCE_NAME/config/obj.conf");
# Append the MAGNUS_CONF_APPEND_STRING value at the end of magnus.conf file.
my $magnusConfFile = "$INSTANCE_ROOT/$INSTANCE_NAME/config/magnus.conf";
# migrate existing obj.conf configurations.
# Create a new obj.conf
$values = "$1".",index.php";
type=magnus-internal/php exts=php,php3,php4,php5
my $newLibPath = "$l_php_root/lib";
my $newLibPath64 = "$l_php_root/lib/64";
Service type="magnus-internal/php"
app-path="$l_php_root/bin/php-cgi"
Service type="magnus-internal/php" fn="set-variable" error="404"
Service type="magnus-internal/php"
app-path="$l_php_root/php-cgi.exe"
Service type="magnus-internal/php" fn="php5_execute"
exit 1 unless defined isValidFile("$INSTANCE_ROOT/$INSTANCE_NAME/config/magnus.conf");
$file = "$INSTANCE_ROOT/$INSTANCE_NAME/config/$fileName";
$INSTALL_ROOT/bin/wadm [--user=admin-user] [--password-file=admin-pswd-file] [--host=admin-host] [--port=admin-port]
For Example: If the host name for the node is xyz.com then enter the command like,
pull-config --config=$configName xyz.com