-Configuration of your Netscape or iPlanet Web Server for PHP4
+Configuration of your Netscape/SunONE/iPlanet Web Server for PHP4
-------------------------------------------------------------
These instructions are targetted at Netscape Enterprise Web Server and
-SUN/Netscape Alliance iPlanet Web Server. On other web servers your
-milage may vary.
+SUN/Netscape Alliance iPlanet Web Server/SunONE Webserver.
+On other web servers your milage may vary.
Firstly you may need to add some paths to the LD_LIBRARY_PATH
environment for Netscape to find all the shared libs. This is best done
<path-to-netscape-server>/https-servername/start
-Netscape config files are located in:
+Netscape/iPlanet/SunONE config files are located in:
- <path-to-netscape-server>/https-servername/config
+ <path-to-server>/https-servername/config
-Add the following line to mime.types:
+Add the following line to mime.types (you can do that by the administration server):
type=magnus-internal/x-httpd-php exts=php
-Add the following to obj.conf (for iPlanet/SunONE Web Server 6.0 and above however, you need to make the specified changes to the Init function
-in the server-id/config/magnus.conf file, and not the server-id/config/obj.conf file):
+Place the following two lines after mime.types init in
+<path-to-server>/https-servername/config/obj.conf (for servers < 6) or
+for iPlanet/SunONE Web Server 6.0 and above however at the end of the
+<path-to-server>/https-servername/config/magnus.conf file:
-"shlib" will vary depending on your OS:
+ Init fn="load-modules" funcs="php4_init,php4_execute,php4_auth_trans" shlib="/path/to/phplibrary"
+ Init fn=php4_init errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]
- Unix: "<path-to-netscape-server>/bin/libphp4.so".
- Windows: "c:\path\to\PHP4\nsapiPHP4.dll"
+The "shlib" will vary depending on your OS:
+ Unix: "<path-to-server>/bin/libphp4.so".
+ Windows: "c:/path/to/PHP4/nsapiPHP4.dll"
-Note! Place following two lines after mime.types init ([] means optional):
- Init fn="load-modules" funcs="php4_init,php4_close,php4_execute,php4_auth_trans" shlib="/php4/nsapiPHP4.dll"
- Init fn=php4_init errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]
+In obj.conf (for virtual server classes [SunONE 6.0] in their vserver.obj.conf):
<Object name="default">
.
# all 'AddLog' lines
# You can modify some entries in php.ini request specific by adding it to the Service
# directive, e.g. doc_root="/path"
+ # For boolean ini-keys please use 0/1 as value, NOT "On","Off",... (this will not work
+ # correctly), e.g. zlib.output_compression=1 instead of zlib.output_compression="On"
Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value ...]
.
.
+ .
</Object>
+This is only needed if you want to configure a directory that only consists of
+PHP scripts (same like a cgi-bin directory):
+
<Object name="x-httpd-php">
ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
- Service fn=php4_execute
- </Object>
+ Service fn="php4_execute" [inikey=value ...]
+ </Object>
+
+After that you can configure a directory in the Administration server and assign it
+the style "x-httpd-php". All files in it will get executed as PHP. This is nice to
+hide PHP usage by renaming files to .html
Authentication configuration
PHP_MINFO_FUNCTION(nsapi);
PHP_FUNCTION(virtual);
+PHP_FUNCTION(nsapi_request_headers);
+PHP_FUNCTION(nsapi_response_headers);
ZEND_BEGIN_MODULE_GLOBALS(nsapi)
long read_timeout;
* Every user visible function must have an entry in nsapi_functions[].
*/
function_entry nsapi_functions[] = {
- PHP_FE(virtual, NULL) /* Make subrequest */
- {NULL, NULL, NULL} /* Must be the last line in nsapi_functions[] */
+ PHP_FE(virtual, NULL) /* Make subrequest */
+ PHP_FE(nsapi_request_headers, NULL) /* get request headers */
+ PHP_FALIAS(getallheaders, nsapi_request_headers, NULL) /* compatibility */
+ PHP_FALIAS(apache_request_headers, nsapi_request_headers, NULL) /* compatibility */
+ PHP_FE(nsapi_response_headers, NULL) /* get response headers */
+ PHP_FALIAS(apache_response_headers, nsapi_response_headers, NULL) /* compatibility */
+ {NULL, NULL, NULL}
};
/* }}} */
NULL,
NULL,
PHP_MINFO(nsapi),
- NO_VERSION_YET,
+ "$Id$",
STANDARD_MODULE_PROPERTIES
};
/* }}} */
PHP_MINFO_FUNCTION(nsapi)
{
php_info_print_table_start();
- php_info_print_table_row(2, "NSAPI support", "enabled");
+ php_info_print_table_row(2, "NSAPI Module Version", nsapi_module_entry.version);
php_info_print_table_row(2, "Server Software", system_version());
php_info_print_table_row(2, "Sub-requests with virtual()",
(nsapi_servact_service)?((zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0))?"not supported with zlib.output_compression":"enabled"):"not supported on this platform" );
}
/* }}} */
+/* {{{ proto array nsapi_request_headers(void)
+ Get all headers from the request */
+PHP_FUNCTION(nsapi_request_headers)
+{
+ register int i;
+ struct pb_entry *entry;
+ nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+
+ if (array_init(return_value) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ for (i=0; i < rc->rq->headers->hsize; i++) {
+ entry=rc->rq->headers->ht[i];
+ while (entry) {
+ if (!PG(safe_mode) || strcasecmp(entry->param->name, "authorization")) {
+ add_assoc_string(return_value, entry->param->name, entry->param->value, 1);
+ }
+ entry=entry->next;
+ }
+ }
+}
+/* }}} */
+
+/* {{{ proto array nsapi_response_headers(void)
+ Get all headers from the response */
+PHP_FUNCTION(nsapi_response_headers)
+{
+ register int i;
+ struct pb_entry *entry;
+ nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
+
+ if (array_init(return_value) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ php_header();
+
+ for (i=0; i < rc->rq->srvhdrs->hsize; i++) {
+ entry=rc->rq->srvhdrs->ht[i];
+ while (entry) {
+ add_assoc_string(return_value, entry->param->name, entry->param->value, 1);
+ entry=entry->next;
+ }
+ }
+}
+/* }}} */
+
/*************/
/* SAPI part */
for (i=0; i < rc->rq->headers->hsize; i++) {
entry=rc->rq->headers->ht[i];
while (entry) {
- snprintf(buf, NS_BUF_SIZE, "HTTP_%s", entry->param->name);
- for(p = buf + 5; *p; p++) {
- *p = toupper(*p);
- if (*p < 'A' || *p > 'Z') {
- *p = '_';
+ if (!PG(safe_mode) || strcasecmp(entry->param->name, "authorization")) {
+ snprintf(buf, NS_BUF_SIZE, "HTTP_%s", entry->param->name);
+ for(p = buf + 5; *p; p++) {
+ *p = toupper(*p);
+ if (*p < 'A' || *p > 'Z') {
+ *p = '_';
+ }
}
+ buf[NS_BUF_SIZE]='\0';
+ php_register_variable(buf, entry->param->value, track_vars_array TSRMLS_CC);
}
- buf[NS_BUF_SIZE]='\0';
- php_register_variable(buf, entry->param->value, track_vars_array TSRMLS_CC);
entry=entry->next;
}
}