|
 |
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 Sun Solaris.
From PHP 4.3.3 on you can use PHP scripts with the
NSAPI module to
generate custom directory
listings and error pages. Additional functions for Apache
compatibility are also available. For support in current webservers read
the note about subrequests.
You can find more information about setting up PHP for the Netscape
Enterprise Server (NES) here:
http://benoit.noss.free.fr/php/install-php4.html
To build PHP with Sun JSWS/Sun ONE WS/iPlanet/Netscape webservers,
enter the proper install directory for the
--with-nsapi=[DIR]
option. The default directory is usually
/opt/netscape/suitespot/.
Please also read /php-xxx-version/sapi/nsapi/nsapi-readme.txt.
Install the following packages from
http://www.sunfreeware.com/ or another download site:
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 (if you want mysql support)
| perl-5_005_03-sol26-sparc-local | tar-1.13 (GNU tar) |
Make sure your path includes the proper directories
PATH=.:/usr/local/bin:/usr/sbin:/usr/bin:/usr/ccs/bin
and make it available to your system export PATH.
gunzip php-x.x.x.tar.gz (if you have a .gz dist,
otherwise go to 4).
tar xvf php-x.x.x.tar
Change to your extracted PHP directory:
cd ../php-x.x.x
For the following step, make sure
/opt/netscape/suitespot/ is
where your netscape server is installed. Otherwise, change to the
correct path and run:
./configure --with-mysql=/usr/local/mysql \
--with-nsapi=/opt/netscape/suitespot/ \
--enable-libgcc |
Run make followed by make install.
After performing the base install and reading the appropriate readme file,
you may need to perform some additional configuration steps.
Замечание:
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 "MAGNUS EDITOR").
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 PATH_INFO, HTTP_HOST
etc. it is not the correct way to try this in the old PHP 3.x way with
getenv() or a similar way (register globals to
environment, $_ENV). You would only get the environment
of the running webserver without any valid CGI variables!
Замечание:
Why are there (invalid) CGI variables in the environment?
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.
Simply change your scripts to get CGI variables in the correct way for
PHP 4.x by using the superglobal $_SERVER. If you have
older scripts which use $HTTP_HOST, etc., you should turn
on register_globals in php.ini and change the variable
order too (important: remove "E" from it,
because you do not need the environment here):
variables_order = "GPCS"
register_globals = On |
You can use PHP to generate the error pages for "404 Not Found"
or similar. Add the following line to the object in obj.conf for
every error page you want to overwrite:
Error fn="php4_execute" code=XXX script="/path/to/script.php" [inikey=value inikey=value...] |
where XXX is the HTTP error code. Please delete
any other Error directives which could interfere with yours.
If you want to place a page for all errors that could exist, leave
the code parameter out. Your script can get the HTTP status code
with $_SERVER['ERROR_TYPE'].
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
type="magnus-internal/directory"
in obj.conf with the following:
Service fn="php4_execute" type="magnus-internal/directory" script="/path/to/script.php" [inikey=value inikey=value...] |
For both error and directory listing pages the original URI and
translated URI are in the variables $_SERVER['PATH_INFO'] and
$_SERVER['PATH_TRANSLATED'].
The NSAPI module now supports the nsapi_virtual() function
(alias: virtual())
to make subrequests on the webserver and insert the result in the webpage.
This function uses some undocumented features from the NSAPI library.
On Unix the module automatically looks for the needed functions and uses
them if available. If not, nsapi_virtual() is disabled.
Sun, iPlanet and Netscape servers on Sun Solaris
ericbackstrom at hotmail dot com
27-Mar-2006 03:09
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"
vijay
13-Mar-2006 06:48
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
jedokahn at yahoo dot com at
23-Nov-2004 12:50
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.
masochisthalo at yahoo dot com
23-Aug-2004 02:28
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: manual/en/install.unix.sun.php
mark at markround dot com
19-Aug-2004 09:36
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]
| |