Configuring Sun Web Server 7 with PHP runtime in OpenSolaris
Installing PHP 5.2.9 in OpenSolaris 2009.06 (preview build)
Check out my earlier blog on how to get PHP 5.2.9 runtime within OpenSolaris 2009.06 on your system.
Installing Sun Web Server 7
Now, if you are new to Sun Web Server 7 and wonder why you need this beast, please do check out our performance benchmarks. You can download and install the latest version of Sun Java System Web Server from here .
If you are adventurous, you can also build the open sourced version of this beast (available under BSD license) by following the instructions provided here.
If you would like a little hand holding in installing our product, check out this nice demo . Hope, you are able to successfully install Sun Web Server 7 with the help of this demo. If not, you can always post your questions in our forums - where we developers will be happy to help you out !.
Note1: You will need to install Java development environment within your OpenSolaris before proceeding to install Sun Web Server 7 on OpenSolaris . You could do this by running the following command from the command line window
sriramn@sriramn:~> pfexec pkg install java-dev
Note2: You will need to perform Web Server installation as 'root' (or use pfexec ./setup) and choose Web Server runtime user as 'webservd'. Please check out this blog for more information on installing Web Server 7 on OpenSolaris.
Finally, let us hook up PHP runtime within Sun Web Server 7. To do this, run the following script (which is newly available from OpenSolaris 2009.06 preview build 110 or above)
sriramn@sriramn:~> pfexec /usr/php/5.2/samples/scripts/configure-sun-webserver --installroot=/sun/webserver7 --instancename=
* where /sun/webserver7 is the location of the Web Server 7 top level installation location. Provide the appropriate location as in your case.
* and https-sriramn -> is the instance created under this installation. The instance name is typically the name of your hostname. You need to provide the appropriate value here.
Now, you will need to restart the Web Server 7 instance by running these below commands so that the newly modified changes can be loaded.
sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/stopserv
sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/startserv
Sun Web Server 7 is now ready to serve any PHP pages within its document
root. For example, to deploy Joomla or Drupal, all you need to do is
unpack these application tar balls under /sun/webserver7/https-sriramn/docs/ and point your browser to http://localhost/joomla etc.
Now, you could write few PHP script within Web Server document root directory (<install-root>/<instance-name>/docs) and test our your configurations. If you are satisfied then we now need to move to the final step. Web Server 7 Administration server need to be told of what we just did. This is accomplished easily by running these following CLI commands
sriramn@sriramn:~> pfexec chown webservd:webservd /sun/webserver7/https-*/config/*obj.conf
sriramn@sriramn:~> /sun/webserver7/bin/wadm pull-config --user=admin --config=sriramn sriramn.sun.com
where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose
and
sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.
Note: Web Server 7 integrates a Java web container within its default server instance. Having an integrated web container will allow you to deploy Java Web Applications like JSP, Servlet etc. Hence, Sun Web Server has to load Java runtime as part of server startup - eating your previous CPU and memory resource. Now, if you plan on using only PHP runtme, you can easily disable Java Web Container by running he following commands :
sriramn@sriramn:~> /sun/webserver7/bin/wadm disable-java --user=admin --config=sriramn sriramn.sun.com
sriramn@sriramn:~> /sun/webserver7/bin/wadm deploy-config --user=admin sriramn.sun.com
again where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose
and
Hope you will like our simplified integration and let us know with your feedback at our forum.


Thanks Sriram,
When I execute the setup file in OpenSolaris, I get the following error:
./setup
InvocationTargetException in ArchiveReader constructornull
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at WebServer.WebServer.instantiateArchiveReader(ArchiveClassLoader.java:203)
at WebServer.WebServer.<init>(ArchiveClassLoader.java:143)
at WebServer.WebServer.main(ArchiveClassLoader.java:1318)
Caused by: java.lang.UnsatisfiedLinkError: /export/home/phantom/Downloads/sjsws-7_0u5-solaris-amd64/WebServer/jdk/jre/lib/i386/motif21/libmawt.so: ld.so.1: java: fatal: libXm.so.4: open failed: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
at java.lang.Runtime.load0(Runtime.java:769)
at java.lang.System.load(System.java:968)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.Component.<clinit>(Component.java:547)
at com.sun.install.tasks.InstallCommandLineTask.processLocales(InstallCommandLineTask.java:598)
at com.sun.install.tasks.InstallCommandLineTask.processCommandLineArguments(InstallCommandLineTask.java:546)
at com.sun.install.tasks.InstallCommandLineTask.initialize(InstallCommandLineTask.java:61)
at com.sun.wizards.core.Sequence.initialize(Sequence.java:180)
at com.sun.wizards.core.GenericWizardState.setWizardState(GenericWizardState.java:1901)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.wizards.core.ArchiveReader.callObjectMethod(ArchiveReader.java:1417)
at com.sun.wizards.core.ArchiveReader.<init>(ArchiveReader.java:287)
... 7 more
Target Exception Trace:
java.lang.UnsatisfiedLinkError: /export/home/phantom/Downloads/sjsws-7_0u5-solaris-amd64/WebServer/jdk/jre/lib/i386/motif21/libmawt.so: ld.so.1: java: fatal: libXm.so.4: open failed: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1647)
at java.lang.Runtime.load0(Runtime.java:769)
at java.lang.System.load(System.java:968)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.Component.<clinit>(Component.java:547)
at com.sun.install.tasks.InstallCommandLineTask.processLocales(InstallCommandLineTask.java:598)
at com.sun.install.tasks.InstallCommandLineTask.processCommandLineArguments(InstallCommandLineTask.java:546)
at com.sun.install.tasks.InstallCommandLineTask.initialize(InstallCommandLineTask.java:61)
at com.sun.wizards.core.Sequence.initialize(Sequence.java:180)
at com.sun.wizards.core.GenericWizardState.setWizardState(GenericWizardState.java:1901)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.wizards.core.ArchiveReader.callObjectMethod(ArchiveReader.java:1417)
at com.sun.wizards.core.ArchiveReader.<init>(ArchiveReader.java:287)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at WebServer.WebServer.instantiateArchiveReader(ArchiveClassLoader.java:203)
at WebServer.WebServer.<init>(ArchiveClassLoader.java:143)
at WebServer.WebServer.main(ArchiveClassLoader.java:1318)
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: com.sun.wizards.core.WizardComponent
at com.sun.wizards.core.WizardTreeManager.createWizardPanel(WizardTreeManager.java:890)
at com.sun.wizards.core.WizardTreeManager.<init>(WizardTreeManager.java:325)
at com.sun.wizards.core.CommandLineConsole.run(CommandLineConsole.java:75)
at java.lang.Thread.run(Thread.java:595)
My platform:
5.11 snv_110 i86pc i386 i86pc Solaris
Posted by Phantom on March 28, 2009 at 12:12 AM PDT #
Hi
Please check my earlier blog - http://blogs.sun.com/natarajan/entry/installing_web_server_7_in1 - for more detailed steps on how to install web server 7 on opensolaris.
in simple terms, you need to setup java environment in opensolaris before installing sun web server - because OpenSolaris brings in those runtime dependencies that web server looks for - only if java-dev packages is installed.
so, please try doing
pfexec pkg install java-dev
before installing web server 7 on your machine
Posted by Sriram Natarajan on March 28, 2009 at 04:43 PM PDT #