PHP Velho Oeste 2024

Sun, iPlanet e servidores Netscape no Solaris da Sun

Essa seção contem notas e dicas específicas para instação do PHP nos servidores un Java System Web Server, Sun ONE Web Server, iPlanet e Netscape no Solaris.

A partir do PHP 4.3.3, você pode usar scripts PHP com o módulo NSAPI para gerar listagem de diretórios e páginas de erro personalizadas. Funções adicionais para compatibilidade com o Apache também estão disponíveis. Para suporte nos webservers atuais, leia a nota sobre sub-requisições.

Você pode achar mais informações sobre como instalar o PHP para o Servidor Netscape Enterprise (NES) aqui: » http://benoit.noss.free.fr/php/install-php4.html

Para compilar o PHP com servidores web Sun JSWS/Sun ONE WS/iPlanet/Netscape, entre o diretório apropriado de instalação para a opção --with-nsapi=[DIR] O diretório padrão é, normalmente /opt/netscape/suitespot/. Por favor, leia também /php-xxx-version/sapi/nsapi/nsapi-readme.txt.

  1. Instale os seguintes pacotes de »  http://www.sunfreeware.com/ ou outro site de download:

    • 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 (se você quiser suporte ao MySQL)
    • perl-5_005_03-sol26-sparc-local
    • tar-1.13 (GNU tar)

  2. Assegure-se que seu PATH inclue os diretórios apropriados PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin E está disponível para o seu sistema export PATH.
  3. gunzip php-x.x.x.tar.gz (se você tiver uma distribuição .gz, caso contrário vá para o passo 4).
  4. tar xvf php-x.x.x.tar
  5. Mude para o diretório recém-criado: cd ../php-x.x.x
  6. Para o passo seguinte, assegure-se de que /opt/netscape/suitespot/ é onde o seu servidor Netscape está instalado. Caso contrário, mude o comando abaixo para o caminho correto e execute:

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

  7. Execute make seguido de make install.

Depois de fazer a instalação básica e ler o arquivo readme apropriado, você pode precisar executar alguns passos extras de configuração.

Instruções de Configuração para o Sun/iPlanet/Netscape

Primeiramente, você pode preciasr adicionar alguns caminhos para a váriavel de ambiente LD_LIBRARY_PATH para que o servidor ache as bibliotecas compartilhadas. A melhor maneira de fazer isso é no script de inicialização do ser servidor web. Esse script normalmente está localizado em: /caminho/para/servidor/https-nome_do_servidor/start. Você pode precisar também de editar os arquivos de configuração que estão localizados em: /caminho/para/servidor/https-nome_do_servidor/config/.

  1. Adicione a seguinte linha no arquivo mime.types (você pode fazer isso pelo servidor de administração):

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

  2. Edite o arquivo magnus.conf (para servidores >= 6) ou o arquivo obj.conf (para servidores < 6) e adicione a seguinte biblioteca compartilhada que pode variar dependendo do seu sistema, ela se parecererá com /opt/netscape/suitespot/bin/libphp4.so. Você deve colocar as seguintes linhas após 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) O parâmetro php_ini é opcional mas com ele você pode colocar seu arquivo php.ini no diretório config do seu servidor web.

  3. Configure o objeto padrão no arquivo obj.conf (para classes de servidor virtuais [versão 6.0+] no arquivo vserver.obj.conf):

    <Object name="default">
    .
    .
    .
    .#NOTA Essa linha deve acontecer após todos as linhas 'ObjectType' e antes de todas as linas 'AddLog'
    Service fn="php4_execute" type="magnus-internal/x-httpd-php" [inikey=value inikey=value ...]
    .
    .
    </Object>
    
    (PHP >= 4.3.3) Como parâmetros adicionais, você pode acrescentar valores especiais do php.ini, por exemplo, você pode editar um docroot="/path/to/docroot" específico para o contexto php4_execute chamado. Para valores booleanos, use 0/1 como valor, não "On","Off",... (isso não funcionará corretamente) ,ex.: zlib.output_compression=1 ao invés de zlib.output_compression="On"

  4. Isso só é necessários se você quiser configurar um diretório que apenas consiste de scripts PHP (assim como um diretório 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>
    
    Depois que você pode configurar um diretório no servidor de Administração e atribuir a ele o estilo x-httpd-php. Todos os arquivo no diretório serão executados como PHP. Isso é bom para esconder uso do PHP renomeando os arquivos para .html.

  5. Configuração de autenticação: autenticação do PHP não pode ser usada com qualquer outra autenticação. TODA AUTENTICAÇÃO E PASSADA PARA O SEU SCRIPT PHP. Para configurar autenticação via PHP para o servidor todo, adicione a seguinte linha para o seu objeto padrão:

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

  6. Para usar autenticação via PHP em apenas um diretório, adicione o seguinte:

    <Object ppath="d:\path\to\authenticated\dir\*">
    AuthTrans fn=php4_auth_trans
    </Object>
    

Nota:

O tamanho da pilha que o PHP usa depende da configuração do servidor web. Se você tiver problemas com scripts PHP muito grandes, é recomendado aumentar o tamanho da pilha com o Admin Server (na seção "MAGNUS EDITOR").

Ambiente CGI e modificações recomendadas ao arquivo php.ini

É importante ter em mente quando escrever scripts PHP que os servidores web Sun JSWS/Sun ONE WS/iPlanet/Netscape são multithreaded. Por isso, todas as requisições estão rodando no mesmo espaço de processo (o espaço do servidor web em si) e esse espaço só tem um ambiente. Se você quiser usar variáveis CGI como PATH_INFO, HTTP_HOST etc, não é correto tentar fazer da maneira como PHP antigo faz, com a função getenv() ou de maneira similar (registrando globais ao ambiente, $_ENV). Você só pegaria o ambiente do servidor web sem qualquer variáveis CGI válidas.

Nota:

Por que existem variáveis CGI inválidas no ambiente?

Resposta: Isso é porque você iniciou o processo do servidor do admin server que roda o script de iniciação do mesmo, você queria iniciar como um script CGI (um script CGI dentro do admin server!). Isso é porque o ambiente do servidor web iniciado tem algumas variáveis CGI de ambiente nele. Você pode testar isso iniciando o servidor web sem ser do admin server. Use a linha de comando como usuário root e inicie-o manualmente - você verá que não exite nenhuma variável CGI de ambiente.

Simplesmente mudando seus scripts para pegar variáveis CGI é a maneira correta para o PHP 4.x usando o superglobal $_SERVER. Se você tiver scripts velhos que usam $HTTP_HOST, etc., você deve ligar register_globals no arquivo php.ini e mudar a ordem das variáveis também (importante: remova "E" de lá, porque voe não precisa do ambiente aqui):

variables_order = "GPCS"
register_globals = On

Uso especial para páginas de erro e listagem de diretório auto-geradas (PHP >= 4.3.3)

Você pode usar o PHP para gerar as páginas de erro para "404 Not Found" ou similares. Adicione a seguinte linha no objeto do arquivo obj.conf para cada página de erro que você quiser sobrescrever:

Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...]
Onde XXX é o código do erro HTTP. Por favor remova qualquer outra diretiva Error que possa interferir com as suas. Se você quiser colocar uma página para todos os erros que podem existir, tire o parâmetro code. Seu script pode pegar o código do erro com $_SERVER['ERROR_TYPE'].

Outra possibilidade é criar uma listagem do diretório auto-gerada. Apenas crie um script PHP que mostra uma listagem do diretório e substitua o padrão correspondente Service line for type="magnus-internal/directory" no arquivo obj.conf pelo seguinte:

Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...]
Tanto para os erros e as páginas de listagem do diretório a URI original e a URL traduzida estão nas variáveis $_SERVER['PATH_INFO'] e $_SERVER['PATH_TRANSLATED'].

Nota sobre nsapi_virtual() e sub-requisições(PHP >= 4.3.3)

O módulo NSAPI agora suporta a função nsapi_virtual() (sinônima (alias): virtual()) para fazer sub-requisições no servidor web e inserir o resultado na página web. Essa função usa algumas funcionalidades não documentadas da biblioteca NSAPI. No Unix, o módulo procura automaticamente para as funções necessárias e as usa se estiverem disponíveis. Se não, nsapi_virtual() é desabilitada.

Nota:

Mas esteja avisado: Suporte para nsapi_virtual() é 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