Configuring Sun Web Server 7 with PHP runtime in OpenSolaris
By sriram on Mar 27, 2009
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.
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
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
Hope you will like our simplified integration and let us know with your feedback at our forum.