nsapi-readme.txt 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. Configuration of your Netscape/iPlanet/Sun Webserver for PHP5
  2. -----------------------------------------------------------------
  3. These instructions are targeted at Netscape Enterprise Web Server and
  4. SUN/Netscape Alliance iPlanet Web Server and the new Sun Java System Webserver.
  5. On other web servers your milage may vary.
  6. Firstly you may need to add some paths to the LD_LIBRARY_PATH
  7. environment for Netscape to find all the shared libs. This is best done
  8. in the start script for your Netscape server. Windows users can
  9. probably skip this step. The start script is located in:
  10. <path-to-netscape-server>/https-servername/start
  11. Netscape/iPlanet/Sun config files are located in:
  12. <path-to-server>/https-servername/config
  13. Add the following line to mime.types (you can do that by the administration server):
  14. type=magnus-internal/x-httpd-php exts=php
  15. Place the following two lines after mime.types init in
  16. <path-to-server>/https-servername/config/obj.conf (for servers < 6) or
  17. for iPlanet/Sun Webserver 6.0 and above however at the end of the
  18. <path-to-server>/https-servername/config/magnus.conf file:
  19. Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="/path/to/phplibrary"
  20. Init fn=php5_init errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]
  21. The "shlib" will vary depending on your OS:
  22. Unix: "<path-to-server>/bin/libphp5.so".
  23. Windows: "c:/path/to/php5/php5nsapi.dll"
  24. In obj.conf (for virtual server classes [Sun 6.0+] in their vserver.obj.conf):
  25. <Object name="default">
  26. .
  27. .
  28. .
  29. # NOTE this next line should happen after all 'ObjectType' and before
  30. # all 'AddLog' lines
  31. # You can modify some entries in php.ini request specific by adding it to the Service
  32. # directive, e.g. doc_root="/path"
  33. # For boolean ini-keys please use 0/1 as value, NOT "On","Off",... (this will not work
  34. # correctly), e.g. zlib.output_compression=1 instead of zlib.output_compression="On"
  35. Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value ...]
  36. .
  37. .
  38. .
  39. </Object>
  40. This is only needed if you want to configure a directory that only consists of
  41. PHP scripts (same like a cgi-bin directory):
  42. <Object name="x-httpd-php">
  43. ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
  44. Service fn="php5_execute" [inikey=value ...]
  45. </Object>
  46. After that you can configure a directory in the Administration server and assign it
  47. the style "x-httpd-php". All files in it will get executed as PHP. This is nice to
  48. hide PHP usage by renaming files to .html
  49. Note: The stacksize that PHP uses depends on the configuration of the webserver. If you get
  50. crashes with very large PHP scripts, it is recommended to raise it with the Admin Server
  51. (in the section "MAGNUS EDITOR").
  52. Authentication configuration
  53. ----------------------------
  54. PHP authentication cannot be used with any other authentication. ALL
  55. AUTHENTICATION IS PASSED TO YOUR PHP SCRIPT. To configure PHP
  56. Authentication for the entire server, add the following line:
  57. <Object name="default">
  58. AuthTrans fn=php5_auth_trans
  59. .
  60. .
  61. .
  62. .
  63. </Object>
  64. To use PHP Authentication on a single directory, add the following:
  65. <Object ppath="d:\path\to\authenticated\dir\*">
  66. AuthTrans fn=php5_auth_trans
  67. </Object>
  68. Special use for error pages or self-made directory listings
  69. -----------------------------------------------------------
  70. You can use PHP to generate the error pages for "404 Not Found"
  71. or similar. Add the following line to the object in obj.conf for
  72. every error page you want to overwrite:
  73. Error fn="php5_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
  74. where XXX ist the HTTP error code. Please delete any other Error
  75. directives which could interfere with yours.
  76. If you want to place a page for all errors that could exist, leave
  77. the "code" parameter out. Your script can get the HTTP status code
  78. with $_SERVER['ERROR_TYPE'].
  79. Another posibility is to generate self-made directory listings.
  80. Just generate a PHP script which displays a directory listing and
  81. replace the corresponding default Service line for
  82. type="magnus-internal/directory" in obj.conf with the following:
  83. Service fn="php5_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
  84. For both error and directory listing pages the original URI and
  85. translated URI are in the variables $_SERVER['PATH_INFO'] and
  86. $_SERVER['PATH_TRANSLATED'].
  87. Note about nsapi_virtual() and subrequests
  88. ------------------------------------------
  89. The NSAPI module now supports the nsapi_virtual() function (alias: virtual())
  90. to make subrequests on the webserver and insert the result in the webpage.
  91. The problem is, that this function uses some undocumented features from
  92. the NSAPI library.
  93. Under Unix this is not a problem, because the module automatically looks
  94. for the needed functions and uses them if available. If not, nsapi_virtual()
  95. is disabled.
  96. Under Windows limitations in the DLL handling need the use of a automatic
  97. detection of the most recent ns-httpdXX.dll file. This is tested for servers
  98. till version 6.1. If a newer version of the Sun server is used, the detection
  99. fails and nsapi_virtual() is disabled.
  100. If this is the case, try the following:
  101. Add the following parameter to php5_init in magnus.conf:
  102. Init fn=php5_init ... server_lib="ns-httpdXX.dll"
  103. where XX is the correct DLL version number. To get it, look in the server-root
  104. for the correct DLL name. The DLL with the biggest filesize is the right one.
  105. But be warned: SUPPORT FOR nsapi_virtual() IS EXPERIMENTAL !!!
  106. $Id$