File: sun.xml

package info (click to toggle)
phpdoc 20050512-1
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 36,592 kB
  • ctags: 1,501
  • sloc: xml: 376,768; php: 6,708; cpp: 500; makefile: 293; perl: 161; sh: 151; awk: 28
file content (328 lines) | stat: -rw-r--r-- 12,582 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
  <sect1 id="install.windows.sun">
   <title>Sun, iPlanet and Netscape servers on Microsoft Windows</title>
   <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.
   </para>
   <para>
    From PHP 4.3.3 on you can use PHP scripts with the
    <link linkend="ref.nsapi">NSAPI module</link> to 
    <link linkend="install.windows.sun.specialpages">generate custom
    directory listings and error pages</link>. Additional functions for
    Apache compatibility are also available. For support in current webservers
    read the <link linkend="install.windows.sun.notes">note about
    subrequests</link>.
   </para>
   
   <sect2 id="install.windows.sun.cgi">
    <title>CGI setup on Sun, iPlanet and Netscape servers</title> 
    <para>
     To install PHP as a CGI handler, do the following:
    </para>
    <itemizedlist>
     <listitem>
      <simpara>
       Copy <filename>php4ts.dll</filename> to your systemroot
       (the directory where you installed Windows)
      </simpara>
     </listitem>
     <listitem>
      <para>
       Make a file association from the command line.
       Type the following two lines:
       <programlisting role="shell">
<![CDATA[
assoc .php=PHPScript
ftype PHPScript=c:\php\php.exe %1 %*
]]>
       </programlisting>
      </para>
     </listitem>
     <listitem>
      <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).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       In the Netscape Enterprise Administration Server create
       a new mime type (Category: type,
       Content-Type: magnus-internal/shellcgi, File Suffix:php).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       Do it for each web server instance you want PHP to run
      </simpara>
     </listitem>
    </itemizedlist>
    <para>
     More details about setting up
     PHP as a CGI executable can be found here:
     <ulink url="&url.netscape.cgi;">&url.netscape.cgi;</ulink>
    </para>
   </sect2>
    
   <sect2 id="install.windows.sun.nsapi">
    <title>NSAPI setup on Sun, iPlanet and Netscape servers</title> 
    <para>
     To install PHP with NSAPI, do the following:
    </para>
    <itemizedlist>
     <listitem>
      <simpara>
       Copy <filename>php4ts.dll</filename> to your systemroot
       (the directory where you installed Windows)
      </simpara>
     </listitem>
     <listitem>
      <para>
       Make a file association from the command line.
       Type the following two lines:
       <programlisting role="shell">
<![CDATA[
assoc .php=PHPScript
ftype PHPScript=c:\php\php.exe %1 %*
]]>
       </programlisting>
      </para>
     </listitem>
     <listitem>
      <simpara>
       In the Netscape Enterprise Administration Server create
       a new mime type (Category: type,
       Content-Type: magnus-internal/x-httpd-php, File Suffix: php).
      </simpara>
     </listitem>
     <listitem>
      <para>
        Edit <filename>magnus.conf</filename> (for servers &gt;= 6) or
        <filename>obj.conf</filename> (for servers &lt; 6) and add the following:
        You should
        place the lines after <literal>mime types init</literal>.
       <programlisting>
<![CDATA[
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"]
]]>
       </programlisting>
       (PHP &gt;= 4.3.3) The <literal>php_ini</literal> parameter is
       optional but with it you can place your
       &php.ini; in your webserver config directory.
      </para>
     </listitem>
     <listitem>
      <para>
       Configure the default object in <filename>obj.conf</filename>
       (for virtual server classes [Sun Web Server 6.0+] in
       their <filename>vserver.obj.conf</filename>):
       In the <literal>&lt;Object name="default"&gt;</literal>
       section, place this line necessarily after all 'ObjectType'
       and before all 'AddLog' lines:
       <programlisting>
<![CDATA[
Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
]]>
       </programlisting>
       (PHP &gt;= 4.3.3) As additional parameters you can add some special
       &php.ini;-values, for example you
       can set a <literal>docroot=&quot;/path/to/docroot&quot;</literal>
       specific to the context <literal>php4_execute</literal>
       is called. For boolean ini-keys please use 0/1 as value,
       not <literal>&quot;On&quot;,&quot;Off&quot;,...</literal>
       (this will not work correctly), e.g.
       <literal>zlib.output_compression=1</literal> instead of
       <literal>zlib.output_compression=&quot;On&quot;</literal>
      </para>
     </listitem>
     <listitem>
      <para>
       This is only needed if you want to configure a directory that only consists of
       PHP scripts (same like a cgi-bin directory):
       <programlisting>
<![CDATA[
<Object name="x-httpd-php">
ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
Service fn=php4_execute [inikey=value inikey=value ...]
</Object>
]]>
       </programlisting>
       After that you can configure a directory in the Administration server and assign it
       the style <literal>x-httpd-php</literal>. All files in it will get executed as PHP.
       This is nice to hide PHP usage by renaming files to <filename>.html</filename>.
      </para>
     </listitem>
     <listitem>
      <simpara>
       Restart your web service and apply changes
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       Do it for each web server instance you want PHP to run
      </simpara>
     </listitem>
    </itemizedlist>
    <note>
     <para>
      More details about setting up
      PHP as an NSAPI filter can be found here:
      <ulink url="&url.netscape.nsapi;">&url.netscape.nsapi;</ulink>
     </para>
    </note>
    <note>
     <para>
      The stacksize that PHP uses depends on the configuration of the webserver. If you get
      crashes with very large PHP scripts, it is recommended to raise it with the Admin Server
      (in the section &quot;MAGNUS EDITOR&quot;).
     </para>
    </note>
   </sect2>
   
   <sect2 id="install.windows.sun.phpini">
    <title>CGI environment and recommended modifications in php.ini</title>
    <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 webserver
     itself) and this space has only one environment. If you want to get CGI
     variables like <literal>PATH_INFO</literal>, <literal>HTTP_HOST</literal>
     etc. it is not the correct way to try this in the old PHP 3.x way with
     <function>getenv</function> or a similar way (register globals to
     environment, <literal>$_ENV</literal>). You would only get the environment
     of the running webserver without any valid CGI variables!
    </para>
    <note>
     <para>
      Why are there (invalid) CGI variables in the environment?
     </para>
     <para>
      Answer: This is because you started the webserver process from the admin server
      which runs the startup script of the webserver, you wanted to start, as a CGI script
      (a CGI script inside of the admin server!). This is why the environment of
      the started webserver has some CGI environment variables in it. You can test
      this by starting the webserver 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.
     </para>
    </note>
    <para>
     Simply change your scripts to get CGI variables in the correct way for
     PHP 4.x by using the superglobal <literal>$_SERVER</literal>. If you have
     older scripts which use <literal>$HTTP_HOST</literal>, etc., you should turn
     on <literal>register_globals</literal> in &php.ini; and change the variable
     order too (important: remove <literal>&quot;E&quot;</literal> from it,
     because you do not need the environment here):
     <programlisting>
<![CDATA[
variables_order = "GPCS"
register_globals = On
]]>
     </programlisting>
    </para>
   </sect2>
   
   <sect2 id="install.windows.sun.specialpages">
    <title>Special use for error pages or self-made directory listings (PHP &gt;= 4.3.3)</title>
    <para>
     You can use PHP to generate the error pages for <literal>"404 Not Found"</literal>
     or similar. Add the following line to the object in <filename>obj.conf</filename> for
     every error page you want to overwrite:
     <programlisting>
<![CDATA[
Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
]]>
     </programlisting>
     where <literal>XXX</literal> is the HTTP error code. Please delete
     any other <literal>Error</literal> directives which could interfere with yours.
     If you want to place a page for all errors that could exist, leave
     the <literal>code</literal> parameter out. Your script can get the HTTP status code
     with <literal>$_SERVER['ERROR_TYPE']</literal>.
    </para>
    <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
     <literal>type=&quot;magnus-internal/directory&quot;</literal>
     in <filename>obj.conf</filename> with the following:
     <programlisting>
<![CDATA[
Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
]]>
     </programlisting>
     For both error and directory listing pages the original URI and
     translated URI are in the variables <literal>$_SERVER['PATH_INFO']</literal> and
     <literal>$_SERVER['PATH_TRANSLATED']</literal>.
    </para>
   </sect2>
   
   <sect2 id="install.windows.sun.notes">
    <title>Note about <function>nsapi_virtual</function> and subrequests (PHP &gt;= 4.3.3)</title>
    <para>
     The NSAPI module now supports the <function>nsapi_virtual</function> function
     (alias: <function>virtual</function>)
     to make subrequests on the webserver and insert the result in the webpage.
     The problem is, that this function uses some undocumented features from
     the NSAPI library.
    </para>
    <para>
     Under Unix this is not a problem, because the module automatically looks
     for the needed functions and uses them if available.
     If not, <function>nsapi_virtual</function> is disabled.
    </para>
    <para>
     Under Windows limitations in the DLL handling need the use of a automatic
     detection of the most recent <filename>ns-httpdXX.dll</filename> file.
     This is tested for servers till version 6.1. If a newer version of the
     Sun server is used, the detection fails and <function>nsapi_virtual</function>
     is disabled.
    </para>
    <para>
     If this is the case, try the following:
     Add the following parameter to <literal>php4_init</literal> in
     <filename>magnus.conf</filename>/<filename>obj.conf</filename>:
     <programlisting>
<![CDATA[
Init fn=php4_init ... server_lib="ns-httpdXX.dll"
]]>
     </programlisting>
     where <literal>XX</literal> 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.
    </para>
    <para>
     You can check the status by using the <function>phpinfo</function> function.
    </para>
    <note>
     <para>
      But be warned: Support for <function>nsapi_virtual</function> is EXPERIMENTAL!!!
     </para>
    </note>
   </sect2>   
  </sect1>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->