Source of: /manual/en/install.unix.sun.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.unix.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'install.unix.sun.php',
1 => 'Sun, iPlanet and Netscape servers on Sun Solaris',
),
'up' =>
array (
0 => 'install.unix.php',
1 => 'Installation on Unix systems',
),
'prev' =>
array (
0 => 'install.unix.fhttpd.php',
1 => 'fhttpd related notes',
),
'next' =>
array (
0 => 'install.unix.commandline.php',
1 => 'CGI and command line setups',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="install.unix.sun" class="sect1">
<h2 class="title">Sun, iPlanet and Netscape servers on Sun Solaris</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 Sun Solaris.
</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.unix.sun.php#install.unix.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.unix.sun.php#install.unix.sun.notes" class="link">note about subrequests</a>.
</p>
<p class="para">
You can find more information about setting up PHP for the Netscape
Enterprise Server (NES) 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>
</p>
<p class="para">
To build PHP with Sun JSWS/Sun ONE WS/iPlanet/Netscape web servers,
enter the proper install directory for the
<a href="configure.about.php#configure.with-nsapi" class="link">--with-nsapi=[DIR]</a>
option. The default directory is usually
<var class="filename">/opt/netscape/suitespot/</var>.
Please also read <var class="filename">/php-xxx-version/sapi/nsapi/nsapi-readme.txt</var>.
</p>
<p class="para">
</p><ol type="1">
<li class="listitem">
<p class="para">
Install the following packages from <a href="http://www.sunfreeware.com/" class="link external">»
http://www.sunfreeware.com/</a> or another download site:
</p><ul class="simplelist">
<li class="member"><var class="filename">autoconf-2.13</var></li>
<li class="member"><var class="filename">automake-1.4</var></li>
<li class="member"><var class="filename">bison-1_25-sol26-sparc-local</var></li>
<li class="member"><var class="filename">flex-2_5_4a-sol26-sparc-local</var></li>
<li class="member"><var class="filename">gcc-2_95_2-sol26-sparc-local</var></li>
<li class="member"><var class="filename">gzip-1.2.4-sol26-sparc-local</var></li>
<li class="member"><var class="filename">m4-1_4-sol26-sparc-local</var></li>
<li class="member"><var class="filename">make-3_76_1-sol26-sparc-local</var></li>
<li class="member">
<var class="filename">mysql-3.23.24-beta</var> (if you want mysql support)
</li>
<li class="member"><var class="filename">perl-5_005_03-sol26-sparc-local</var></li>
<li class="member"><var class="filename">tar-1.13</var> (GNU tar)</li>
</ul><p>
</p>
</li>
<li class="listitem">
<span class="simpara">
Make sure your path includes the proper directories
<i>PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin</i>
and make it available to your system <strong class="userinput"><code>export PATH</code></strong>
.
</span>
</li>
<li class="listitem">
<span class="simpara">
<strong class="userinput"><code>gunzip php-x.x.x.tar.gz</code></strong>
(if you have a <var class="filename">.gz</var> dist,
otherwise go to 4).
</span>
</li>
<li class="listitem">
<span class="simpara">
<strong class="userinput"><code>tar xvf php-x.x.x.tar</code></strong>
</span>
</li>
<li class="listitem">
<span class="simpara">
Change to your extracted PHP directory:
<strong class="userinput"><code>cd ../php-x.x.x</code></strong>
</span>
</li>
<li class="listitem">
<p class="para">
For the following step, make sure
<var class="filename">/opt/netscape/suitespot/</var> is
where your netscape server is installed. Otherwise, change to the
correct path and run:
</p><div class="example-contents programlisting">
<div class="shellcode"><pre class="shellcode">./configure --with-mysql=/usr/local/mysql \
--with-nsapi=/opt/netscape/suitespot/ \
--enable-libgcc</pre>
</div>
</div>
<p>
</p>
</li>
<li class="listitem">
<span class="simpara">
Run <strong class="command">make</strong> followed by <strong class="command">make install</strong>.
</span>
</li>
</ol><p>
</p>
<p class="para">
After performing the base install and reading the appropriate readme file,
you may need to perform some additional configuration steps.
</p>
<p class="formalpara">
<h5 class="title">Configuration Instructions for Sun/iPlanet/Netscape</h5>
<p class="para">
Firstly you may need to add some paths to the <var class="varname">LD_LIBRARY_PATH</var>
environment for the server to find all the shared libs. This can best done
in the start script for your web server. The start script is often located
in: <var class="filename">/path/to/server/https-servername/start</var>.
You may also need to edit the configuration files that are
located in: <var class="filename">/path/to/server/https-servername/config/</var>.
</p><ol type="1">
<li class="listitem">
<p class="para">
Add the following line to <var class="filename">mime.types</var> (you can do
that by the administration server):
<div class="example-contents screen">
<div class="cdata"><pre>
type=magnus-internal/x-httpd-php exts=php
</pre></div>
</div>
</p>
</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,
shlib will vary depending on your system, it will be something like
<var class="filename">/opt/netscape/suitespot/bin/libphp4.so</var>. You should
place the following 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="/opt/netscape/suitespot/bin/libphp4.so"
Init fn="php4_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ini="/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 config directory.
</p>
</li>
<li class="listitem">
<p class="para">
Configure the default object in <var class="filename">obj.conf</var>
(for virtual server classes [version 6.0+] in
their <var class="filename">vserver.obj.conf</var>):
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
<Object name="default">
.
.
.
.#NOTE this next line should happen after all 'ObjectType' and before all 'AddLog' lines
Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
.
.
</Object>
</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 <var class="filename">cgi-bin</var> 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">
<p class="para">
Setup of authentication: PHP authentication cannot be used with any
other authentication. ALL AUTHENTICATION IS PASSED TO YOUR PHP SCRIPT.
To configure PHP Authentication for the entire server, add the
following line to your default object:
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
<Object name="default">
AuthTrans fn=php4_auth_trans
.
.
.
</Object>
</pre></div>
</div>
<p>
</p>
</li>
<li class="listitem">
<p class="para">
To use PHP Authentication on a single directory, add the following:
</p><div class="example-contents programlisting">
<div class="cdata"><pre>
<Object ppath="d:\path\to\authenticated\dir\*">
AuthTrans fn=php4_auth_trans
</Object>
</pre></div>
</div>
<p>
</p>
</li>
</ol><p>
</p>
</p>
<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 id="install.unix.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, <var class="varname"><a href="reserved.variables.environment.php" class="classname">$_ENV</a></var>). 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.unix.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 <i>Service</i> 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.unix.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.
This function uses some undocumented features from the NSAPI library.
On Unix 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>
<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(); ?>