Source of: /manual/kr/install.windows.sun.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.windows.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'kr',
),
'this' =>
array (
0 => 'install.windows.sun.php',
1 => 'Sun, iPlanet and Netscape servers on Microsoft Windows',
),
'up' =>
array (
0 => 'install.windows.php',
1 => '윈도우 시스템에 인스톨하기',
),
'prev' =>
array (
0 => 'install.windows.apache2.php',
1 => '마이크로소프트 윈도우에서 Apache 2.0.x',
),
'next' =>
array (
0 => 'install.windows.omnihttpd.php',
1 => 'OmniHTTPd Server',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="install.windows.sun" class="sect1">
<h2 class="title">Sun, iPlanet and Netscape servers on Microsoft Windows</h2>
<p class="para">
This section contains notes and hints specific to Sun Java System Web Server,
Sun ONE Web Server, iPlanet and Netscape server installs of PHP on Windows.
</p>
<p class="para">
From PHP 4.3.3 on you can use PHP scripts with the
<a href="ref.nsapi.php" class="link">NSAPI module</a> to
<a href="install.windows.sun.php#install.windows.sun.specialpages" class="link">generate custom
directory listings and error pages</a>. Additional functions for
Apache compatibility are also available. For support in current web servers
read the <a href="install.windows.sun.php#install.windows.sun.notes" class="link">note about
subrequests</a>.
</p>
<div id="install.windows.sun.cgi" class="sect2">
<h3 class="title">CGI setup on Sun, iPlanet and Netscape servers</h3>
<p class="para">
To install PHP as a CGI handler, do the following:
</p>
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
Copy <var class="filename">php4ts.dll</var> to your systemroot
(the directory where you installed Windows)
</span>
</li>
<li class="listitem">
<p class="para">
Make a file association from the command line.
Type the following two lines:
</p><div class="example-contents programlisting">
<div class="shellcode"><pre class="shellcode">assoc .php=PHPScript
ftype PHPScript=c:\php\php.exe %1 %*</pre>
</div>
</div>
<p>
</p>
</li>
<li class="listitem">
<span class="simpara">
In the Netscape Enterprise Administration Server create
a dummy shellcgi directory and remove it just after (this
step creates 5 important lines in obj.conf and allow the
web server to handle shellcgi scripts).
</span>
</li>
<li class="listitem">
<span class="simpara">
In the Netscape Enterprise Administration Server create
a new mime type (Category: type,
Content-Type: magnus-internal/shellcgi, File Suffix:php).
</span>
</li>
<li class="listitem">
<span class="simpara">
Do it for each web server instance you want PHP to run
</span>
</li>
</ul>
<p class="para">
More details about setting up
PHP as a CGI executable can be found here:
<a href="http://benoit.noss.free.fr/php/install-php.html" class="link external">» http://benoit.noss.free.fr/php/install-php.html</a>
</p>
</div>
<div id="install.windows.sun.nsapi" class="sect2">
<h3 class="title">NSAPI setup on Sun, iPlanet and Netscape servers</h3>
<p class="para">
To install PHP with NSAPI, do the following:
</p>
<ul class="itemizedlist">
<li class="listitem">
<span class="simpara">
Copy <var class="filename">php4ts.dll</var> to your systemroot
(the directory where you installed Windows)
</span>
</li>
<li class="listitem">
<p class="para">
Make a file association from the command line.
Type the following two lines:
</p><div class="example-contents programlisting">
<div class="shellcode"><pre class="shellcode">assoc .php=PHPScript
ftype PHPScript=c:\php\php.exe %1 %*</pre>
</div>
</div>
<p>
</p>
</li>
<li class="listitem">
<span class="simpara">
In the Netscape Enterprise Administration Server create
a new mime type (Category: type,
Content-Type: magnus-internal/x-httpd-php, File Suffix: php).
</span>
</li>
<li class="listitem">
<p class="para">
Edit <var class="filename">magnus.conf</var> (for servers >= 6) or
<var class="filename">obj.conf</var> (for servers < 6) and add the following:
You should
place the lines after <i>mime types init</i>.
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="c:/php/sapi/php4nsapi.dll"
Init fn="php4_init" LateInit="yes" errorString="Failed to initialise PHP!" [php_ini="c:/path/to/php.ini"]
</pre></div>
</div>
<p>
(PHP >= 4.3.3) The <i>php_ini</i> parameter is
optional but with it you can place your
<var class="filename">php.ini</var> in your web server configuration directory.
</p>
</li>
<li class="listitem">
<p class="para">
Configure the default object in <var class="filename">obj.conf</var>
(for virtual server classes [Sun Web Server 6.0+] in
their <var class="filename">vserver.obj.conf</var>):
In the <i><Object name="default"></i>
section, place this line necessarily after all 'ObjectType'
and before all 'AddLog' lines:
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
</pre></div>
</div>
<p>
(PHP >= 4.3.3) As additional parameters you can add some special
<var class="filename">php.ini</var>-values, for example you
can set a <i>docroot="/path/to/docroot"</i>
specific to the context <i>php4_execute</i>
is called. For boolean ini-keys please use 0/1 as value,
not <i>"On","Off",...</i>
(this will not work correctly), e.g.
<i>zlib.output_compression=1</i> instead of
<i>zlib.output_compression="On"</i>
</p>
</li>
<li class="listitem">
<p class="para">
This is only needed if you want to configure a directory that only consists of
PHP scripts (same like a cgi-bin directory):
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
<Object name="x-httpd-php">
ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
Service fn=php4_execute [inikey=value inikey=value ...]
</Object>
</pre></div>
</div>
<p>
After that you can configure a directory in the Administration server and assign it
the style <i>x-httpd-php</i>. All files in it will get executed as PHP.
This is nice to hide PHP usage by renaming files to <var class="filename">.html</var>.
</p>
</li>
<li class="listitem">
<span class="simpara">
Restart your web service and apply changes
</span>
</li>
<li class="listitem">
<span class="simpara">
Do it for each web server instance you want PHP to run
</span>
</li>
</ul>
<blockquote><p><b class="note">Note</b>:
More details about setting up
PHP as an NSAPI filter can be found here:
<a href="http://benoit.noss.free.fr/php/install-php4.html" class="link external">» http://benoit.noss.free.fr/php/install-php4.html</a>
<br />
</p></blockquote>
<blockquote><p><b class="note">Note</b>:
The stacksize that PHP uses depends on the configuration of the web server. If you get
crashes with very large PHP scripts, it is recommended to raise it with the Admin Server
(in the section "MAGNUS EDITOR").
<br />
</p></blockquote>
</div>
<div id="install.windows.sun.phpini" class="sect2">
<h3 class="title">CGI environment and recommended modifications in <var class="filename">php.ini</var></h3>
<p class="para">
Important when writing PHP scripts is the fact that Sun JSWS/Sun ONE
WS/iPlanet/Netscape is a multithreaded web server. Because of that all
requests are running in the same process space (the space of the web server
itself) and this space has only one environment. If you want to get CGI
variables like <i>PATH_INFO</i>, <i>HTTP_HOST</i>
etc. it is not the correct way to try this in the old PHP way with
<a href="function.getenv.php" class="function">getenv()</a> or a similar way (register globals to
environment, <i>$_ENV</i>). You would only get the environment
of the running web server without any valid CGI variables!
</p>
<blockquote><p><b class="note">Note</b>:
Why are there (invalid) CGI variables in the environment?
<br />
Answer: This is because you started the web server process from the admin server
which runs the startup script of the web server, you wanted to start, as a CGI script
(a CGI script inside of the admin server!). This is why the environment of
the started web server has some CGI environment variables in it. You can test
this by starting the web server not from the administration server. Use
the command line as root user and start it manually - you will see
there are no CGI-like environment variables.
<br />
</p></blockquote>
<p class="para">
Simply change your scripts to get CGI variables in the correct way for
PHP 4.x by using the superglobal <var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER</a></var>. If you have
older scripts which use <var class="varname">$HTTP_HOST</var>, etc., you should turn
on <i>register_globals</i> in <var class="filename">php.ini</var> and change the variable
order too (important: remove <i>"E"</i> from it,
because you do not need the environment here):
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
variables_order = "GPCS"
register_globals = On
</pre></div>
</div>
<p>
</p>
</div>
<div id="install.windows.sun.specialpages" class="sect2">
<h3 class="title">Special use for error pages or self-made directory listings (PHP >= 4.3.3)</h3>
<p class="para">
You can use PHP to generate the error pages for <i>"404 Not Found"</i>
or similar. Add the following line to the object in <var class="filename">obj.conf</var> for
every error page you want to overwrite:
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
</pre></div>
</div>
<p>
where <i>XXX</i> is the HTTP error code. Please delete
any other <i>Error</i> directives which could interfere with yours.
If you want to place a page for all errors that could exist, leave
the <i>code</i> parameter out. Your script can get the HTTP status code
with <var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER['ERROR_TYPE']</a></var>.
</p>
<p class="para">
Another possibility is to generate self-made directory listings.
Just create a PHP script which displays a directory listing and
replace the corresponding default Service line for
<i>type="magnus-internal/directory"</i>
in <var class="filename">obj.conf</var> with the following:
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
</pre></div>
</div>
<p>
For both error and directory listing pages the original URI and
translated URI are in the variables <var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER['PATH_INFO']</a></var> and
<var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER['PATH_TRANSLATED']</a></var>.
</p>
</div>
<div id="install.windows.sun.notes" class="sect2">
<h3 class="title">Note about <a href="function.nsapi-virtual.php" class="function">nsapi_virtual()</a> and subrequests (PHP >= 4.3.3)</h3>
<p class="para">
The NSAPI module now supports the <a href="function.nsapi-virtual.php" class="function">nsapi_virtual()</a> function
(alias: <a href="function.virtual.php" class="function">virtual()</a>)
to make subrequests on the web server and insert the result in the web page.
The problem is, that this function uses some undocumented features from
the NSAPI library.
</p>
<p class="para">
Under Unix this is not a problem, because the module automatically looks
for the needed functions and uses them if available.
If not, <a href="function.nsapi-virtual.php" class="function">nsapi_virtual()</a> is disabled.
</p>
<p class="para">
Under Windows limitations in the DLL handling need the use of a automatic
detection of the most recent <var class="filename">ns-httpdXX.dll</var> file.
This is tested for servers till version 6.1. If a newer version of the
Sun server is used, the detection fails and <a href="function.nsapi-virtual.php" class="function">nsapi_virtual()</a>
is disabled.
</p>
<p class="para">
If this is the case, try the following:
Add the following parameter to <i>php4_init</i> in
<var class="filename">magnus.conf</var>/<var class="filename">obj.conf</var>:
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
Init fn=php4_init ... server_lib="ns-httpdXX.dll"
</pre></div>
</div>
<p>
where <i>XX</i> is the correct DLL version number.
To get it, look in the server-root for the correct DLL name. The
DLL with the biggest filesize is the right one.
</p>
<p class="para">
You can check the status by using the <a href="function.phpinfo.php" class="function">phpinfo()</a> function.
</p>
<blockquote><p><b class="note">Note</b>:
But be warned: Support for <a href="function.nsapi-virtual.php" class="function">nsapi_virtual()</a> is EXPERIMENTAL!!!
<br />
</p></blockquote>
</div>
</div><?php manual_footer(); ?>