PHP Velho Oeste 2024

Servidores Sun, iPlanet y Netscape sobre Sun Solaris

Esta sección contiene notas y consejos específicos al servidor web Sun Java System, servidor web Sun ONE, instalaciones de servidores iPlanet y Netscape de PHP sobre Sun Solaris.

A partir de PHP 4.3.3 en adelante se pueden utilizar scripts PHP con el módulo NSAPI para generar listados de directorio y páginas de errores personalizados. Funciones adicionales para compatibilidad con Apache también se encuentran disponibles. Para soporte en servidores web actuales, léase la nota sobre subpeticiones.

Se puede encontrar más información acerca de configurar PHP para Netscape Enterprise Server (NES) aquí: » http://benoit.noss.free.fr/php/install-php4.html

Para construir PHP con los servidores web Sun JSWS/Sun ONE WS/iPlanet/Netscape, introduzca el directorio de instalación apropiado para la opción --with-nsapi=[DIR]. El directorio por omisión es comúnmente /opt/netscape/suitespot/. Por favor también léase /php-xxx-version/sapi/nsapi/nsapi-readme.txt.

  1. Instalar los siguientes paquetes de »  http://www.sunfreeware.com/ o algún otro sitio de descargas:

    • autoconf-2.13
    • automake-1.4
    • bison-1_25-sol26-sparc-local
    • flex-2_5_4a-sol26-sparc-local
    • gcc-2_95_2-sol26-sparc-local
    • gzip-1.2.4-sol26-sparc-local
    • m4-1_4-sol26-sparc-local
    • make-3_76_1-sol26-sparc-local
    • mysql-3.23.24-beta (si se desea soporte para mysql)
    • perl-5_005_03-sol26-sparc-local
    • tar-1.13 (GNU tar)

  2. Asegurar que la ruta de acceso incluye los directorios apropiados PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin y hacer que esté disponible al sistema export PATH.
  3. gunzip php-x.x.x.tar.gz (si se tiene una distribución .gz, de lo contrario ir a 4).
  4. tar xvf php-x.x.x.tar
  5. Cambiarse al directorio de PHP ya extraído: cd ../php-x.x.x
  6. Para el siguiente paso, asegurar que /opt/netscape/suitespot/ sea donde el servidor netscape está instalado. De no ser así, cambiar a la ruta de acceso correcta y ejecutar:

    ./configure --with-mysql=/usr/local/mysql \
    --with-nsapi=/opt/netscape/suitespot/ \
    --enable-libgcc

  7. Ejecutar make seguido por make install.

Después de realizar la instalación base y de leer el fichero readme apropiado, es posible que sea necesario realizar algunos pasos adicionales de configuración.

Instrucciones de configuración para Sun/iPlanet/Netscape

Primeramente quizás sea necesario agregar algunas rutas de acceso al entorno LD_LIBRARY_PATH para que el servidor encuentre todas las librerías compartidas. Esto puede hacerse de mejor manera en el script de arranque del servidor web. El script de arranque se encuentra comúnmente localizado en: /ruta/al/servidor/https-servername/start. Quizás también sea necesario editar los ficheros de configuración que están ubicados en: /ruta/al/servidor/https-servername/config/.

  1. Agregar la siguiente línea a mime.types (se puede hacer esto por medio del servidor de administración):

    type=magnus-internal/x-httpd-php exts=php
    

  2. Editar magnus.conf (para servidores >= 6) u obj.conf (para servidores < 6) y agregar lo siguiente, shlib variará dependiendo del sistema, será algo así como /opt/netscape/suitespot/bin/libphp4.so. Se deben colocar las siguientes líneas después de mime types init.

    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"]
    
    (PHP >= 4.3.3) El parámetro php_ini es opcional pero con él se puede colocar php.ini en el directorio de configuración del servidor web.

  3. Configurar el objeto por omisión en obj.conf (para clases de servidor virtual [versión 6.0+] en su vserver.obj.conf):

    <Object name="default">
    .
    .
    .
    .#NOTA esta siguiente línea debería ocurrir después de todos las líneas 'ObjectType' y antes de todas las líneas 'AddLog'
    Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
    .
    .
    </Object>
    
    (PHP >= 4.3.3) Como parámetros adicionales se pueden agregar algunos valores especiales de php.ini, por ejemplo se puede fijar una docroot="/ruta/a/raíz_de_documentos" específica al contexto php4_execute es llamado. Para llaves ini boleanas favor de utilizar 0/1 como valor, no "On","Off",... (esto no funcionará correctamente), por ejemplo. zlib.output_compression=1 en vez de zlib.output_compression="On"

  4. Esto es sólo necesario si se quiere configurar un directorio que solamente consiste de scripts de PHP (igual que un directorio cgi-bin):

    <Object name="x-httpd-php">
    ObjectType fn="force-type" type="magnus-internal/x-httpd-php"
    Service fn=php4_execute [inikey=value inikey=value ...]
    </Object>
    
    Después de configurar un directorio en el servidor de administración y asignarle el estilo x-httpd-php. Todos los ficheros en éste se ejecutarán como PHP. Esto está bien para esconder el uso de PHP renombrando los ficheros a .html.

  5. Configuración de la autenticación: La autenticación PHP no puede ser utilizada con ninguna otra autenticación. TODA AUTENTICACION LE ES PASADA AL SCRIPT DE PHP. Para configurar la autenticación de PHP para el servidor entero, agregar la línea siguiente al objeto por omisión:

    <Object name="default">
    AuthTrans fn=php4_auth_trans
    .
    .
    .
    </Object>
    

  6. Para utilizar autenticación de PHP en sólo un directorio, agregar lo siguiente:

    <Object ppath="d:\ruta\al\directorio\auntenticado\*">
    AuthTrans fn=php4_auth_trans
    </Object>
    

Nota:

El tamaño de la pila que utiliza PHP depende de la configuración del servidor web. Si se tienen fallas generales con scripts de PHP muy grandes, se recomienda elevarlo con el servidor de administración (en la sección "MAGNUS EDITOR").

Ambiente CGI y modificaciones recomendadas en php.ini

Importante cuando se escriben scripts de PHP, es el hecho de que Sun JSWS/Sun ONE WS/iPlanet/Netscape es un servidor web multihilos. Por ello todas las peticiones se corren en el mismo espacio de proceso (el espacio del servidor web mismo) y este espacio tiene solamente un ambiente. Si se quiere tener variables CGI como PATH_INFO, HTTP_HOST etc. la manera correcta no es intentar esto al viejo estilo de PHP con getenv() o una manera similar (registrar globales al ambiente, $_ENV). Solamente se obtendrá el ambiente del servidor web que se está ejecutando. ¡Sin ninguna variable CGI válida!

Nota:

¿Por qué hay variables CGI (inválidas) en el ambiente?

Respuesta: Esto es por que se inició el proceso del servidor web desde el servidor de administración que ejecuta el script de arranque del servidor web, que se quería iniciar, como un script de CGI (¡Un script de CGI dentro del servidor de administración!). Esto es el porque el ambiente de el servidor web iniciado tiene algunas variables de CGI en él. Se puede probar esto iniciando el servidor web, no desde el servidor de administración. Utilizar la línea de comando como usuario root e iniciarlo manualmente - se verá que no hay variables de ambiente a la CGI.

Simplemente cámbiense los scripts para obtener las variables CGI de la manera correcta para PHP 4.x utilizando la superglobal $_SERVER. Si se tienen scripts más antiguos que usan $HTTP_HOST, etc., se debe activar register_globals en php.ini y cambiar el orden de las variables también (importante: quitar "E" de ésta, porque no se necesita el entorno aquí):

variables_order = "GPCS"
register_globals = On

Uso especial para páginas de error o listados personalizados de directorios (PHP >= 4.3.3)

Se puede utilizar PHP para generar páginas de errores para "404 Not Found" o similares. Agregar la siguiente línea al objeto en obj.conf por cada página de error que se quiera sobreescribir:

Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
donde XXX es el código de error HTTP. Favor de borrar cualquier otra directiva Error que pudiese interferir con la propia. Si se desea colocar una página para todos los errores que puedan existir, dejar fuera el parámetro code. El script puede obtener el código de estado HTTP con $_SERVER['ERROR_TYPE'].

Otra posibilidad es generar listados de directorio personalizados. Solamente creando un script PHP que despliegue un listado de directorio y reemplazando la línea por omisión correspondiente Service por type="magnus-internal/directory" en obj.conf con lo siguiente:

Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
Para ambas páginas, de error y listados de directorio la URI original y la URI traducida están en las variables $_SERVER['PATH_INFO'] y $_SERVER['PATH_TRANSLATED'].

Nota acerca de nsapi_virtual() y subpeticiones (PHP >= 4.3.3)

El módulo NSAPI ahora soporta la función nsapi_virtual() (alias: virtual()) para realizar subpeticiones en el servidor web e insertar el resultado en la página web. Esta función utiliza algunas características no documentadas de la librería NSAPI. En Unix el módulo automáticamente busca las funciones necesarias y las utiliza si están disponibles. Si no, se deshabilita nsapi_virtual().

Nota:

Pero se advierte: El soporte para nsapi_virtual() es ¡¡¡EXPERIMENTAL!!!

add a note add a note

User Contributed Notes 8 notes

up
1
Lucius Rizzo
10 years ago
http://we.je/oracle-iplanet-web-server-running-on-arch-linux-with-php-fpm-hello-speed-meet-kettle/

If you are looking to setup Oracle iPlanet Web server using the much more effective option of using php-fpm, please follow the link above to learn how to accomplish this.

Lucius Rizzo
www.say.si
up
1
Brian
16 years ago
For me at least, this part of the second line in the magnus.conf is not optional:

Init fn="php5_init" LateInit="yes"

Without it, the web server crashes when trying to execute php files
up
1
jedokahn at yahoo dot com at
19 years ago
I noted and installed *all* pkgs required to compile PHP5 but kept getting an error on compile when it attempted to test the gcc compiler. The /usr/ccs/bin and all the $PATH requirements were ALL there....why the error? I tried running gcc from the command prompt and got a "gcc: fatal: libiconv.so.2: open failed: "....DUH I needed to install the libiconv pkg from sunfreeware.com for gcc compiler to work. Just a small bonehead maneuver, but I thought I would add it just in case someone else ran into the particular problem.
up
0
Lucius Rizzo Lucius dot Rizzo at Has dot Education
10 years ago
In case we.je (the originating domain) is dropped, I thought I'd add one that should last longer

The new URL is:

http://our.guru/oracle-iplanet-web-server-running-on-arch-linux-with-php-fpm-hello-speed-meet-kettle/

--
Lucius Rizzo
www.Lucius.Tel
up
0
mark at markround dot com
19 years ago
Quick note : By replacing "php4" with "php5", the above instructions work perfectly when building PHP5 for an iPlanet server. EG:-

Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" etc.

Works fine here on 6.0SP2, Solaris 9 Sparc.

-Mark
[mark at markround dot com]
up
-1
ericbackstrom at hotmail dot com
18 years ago
Using gcc 3.3 I had problems compiling PHP for 64 bits, I had to replace mysql/64 bits with mysql/32 bits (Solaris cannot mix 32 bits and 64 bits libraries), so I specified the following compiler flag:

CFLAGS="-m32";export CFLAGS;

I also had problems with PHP 5.1.2 in sapi/nsapi/nsapi.c source code, It had incorrect comments and file paths :S

When trying to install PHP with mysql support I found I had these problems too: http://bugs.php.net/bug.php?id=34516... So don't mix sun ld and gcc ld because you will get into troubles. I built mysql libraries myself in a separated directory.

And don't forget to set your LD_LIBRARY_PATH to something like:

LD_LIBRARY_PATH="/usr/local/lib:/usr/lib"
up
-1
masochisthalo at yahoo dot com
19 years ago
Title: Barebones PHP Installation on Sun One Web Server 6.1 for JDS2
Author: Hijinio Reynoso Jr.
Last Updated: August 23, 2004
Summary: If you have installed Sun One Web Server 6.1 on the JDS (aka Java Desktop System from Sun), this will help you get PHP installed on it (without XML and MySQL support.)  In any case, this should get you started which is better than not having it installed at all.  These directions were based mainly on those available from PHP.net, but updated to meet the needs of this specific configuration.

Instructions
----------------------------
0. Make sure your web server isn't running and ensure that all JDS developer packages are installed; to be safe, I always ensure that all developer packages are available via Applications > System Tools > Administration > Software Installer

1. Download http://us3.php.net/get/php-5.0.1.tar.bz2/from/a/mirror and extract into the directory of your choice. (5.0.1 was the only version I could get to make install correctly)

2. CD into the extracted PHP directory and type:
> ./configure --with-nsapi=/opt/SUNWwbsvr --enable-libgcc --disable-libxml
(Your web server directory may vary from the above's default.)

3. Once it's done configuring (and it should be successful should you have all the proper packages), type:
> make

4. When its done compiling, it's time to install as root:
# make install

5. Now, configuration of your web server begins:
# cd /opt/SUNWwbsvr/https-[yourWebServer]/config

6. vi mime.types (or other editor) to add this line into it:
type=magnus-internal/x-httpd-php exts=php

7. vi magnus.conf to add the following 2 lines to end of it:  (NOTE: the 2nd line could be optional)
Init fn="load-modules" funcs="php5_init,php5_execute,php5_auth_trans" shlib="/opt/SUNWwbsvr/bin/libphp5.so"
Init fn="php5_init" LateInit="yes" errorString="Failed to initialize PHP!" [php_ini="/path/to/php.ini"]

8. vi obj.conf to add the following line to <Object name="default">. Make sure this happens after all "ObjectType" entries and before any "AddLog" entries:  (NOTE: for virtual servers, edit vserver.obj.conf)
Service fn="php5_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]

9. Now, start up your web server.  Also, make sure to log into the admin server and click the "Apply" button in there.  You will also have set "index.php" as an index filename in your virtual server's Document Preferences.

10. Congrats!  Now, you have PHP installed!  Of course, there are other features you could enable (MySQL, XML, etc.), but I haven't tested against those.  Just consult the following page for hints: http://www.php.net/manual/en/install.unix.sun.php
up
-2
vijay
18 years ago
If I start my iPlanet (v6.0 SP2) webserver with PHP5.1.2 i get this message every 1/2 sec in my error log....

[12/Mar/2006:11:01:48] failure (15936): Failed to read kernel statistics structures (No such device or address)

This happens only if I start my server loading PHP module. FYI - When I configured my php I had it use oracle instant client libraries.

One fix I found was to comment out this line in my magnus.conf file.

#Init fn="stats-init" profiling="on"

But I don't think i can do this on my prodcution machine. Any ideas to come around this issue?

Thanks
Vijay
To Top