Simplest way to run 'PHP' with Sun Java System Web Server 7.0

Hey
 Are you one of the many millions of web developers developing web sites using PHP ? In that case, you might be interested in knowing that  PHP Add-on 1.0 bundle (PHP 5.2.0 based binaries with FastCGI and NSAPI plugin support) for Sun Java System Web Server 7.0 comes up with a setup script that takes away all the pain in configuring PHP with Sun Java System Web Server 7.0 - Sun's latest Web Server release. 
 
 So, if you are interested in developing or deploying PHP on top of highly scalable Web Server that comes with clustering and monitoring supports, then this is what you can do
  1. Download Sun Java System Web Server 7.0, if you haven't already
  2. Install Web Server 7.0 in your machine.
  3. Download the Sun Java System Web Server 7.0 PHP Add-on 1.0 (PHP pack to work with Sun Java System Web Server) 
  4. Now, cd to <Web Server Install Root>/plugins directory
  5. Let us 'unzip' the downloaded PHP Add-on zip bundle by doing something like
            unzip phppack-5_2_0-<OS-platform>.zip

Now, cd to <Web Server 7.0 Install Root/plugin/php> directory and run the 'setupPHP' with the instance name as the argument. This instance will be now configured to execute 'PHP' scripts.               

Example:

setupPHP <https-foo> where foo will be the name of the instance that you want to execute PHP scripts.

Since this script (setupPHP) makes some changes to your instance's configuration files, Web Server 7.0 administration server will need to be told about it. The way to do this either through 'pull-config' CLI command or through GUI.

Features that I liked in this Add-on

  • Includes 64-bit PHP binaries for Solaris platform where Web Server 7.0 also supports 64-bit . So, if you are interested, you can configure this Add-on as an NSAPI plugin and run Web Server + PHP in 64-bi
  • If I am not mistaken these bits are not officially supported by Sun but still  some amount of  internal testing has been performed on these bits with Web Server 7.0. So, we can expect to not see whole bunch of crashes happening every where
  • Last but not least - configuring PHP with Web Server 7.0  is finally a breeze !

For example, this is what I did on my Windows laptop

Note: Please refer to my earlier blog on how to save the Web Server 7.0 Administration password within a file. You will need this to follow the below steps that I have given here. Without this, you will need to type the password for every command.

Start the 7.0 Administration Server:

C:\\Program Files\\Sun\\WebServer7> admin-server\\bin\\startserv.bat

Create a new configuration and instance to execute all the PHP scripts under :

C:\\Program Files\\Sun\\WebServer7> bin\\wadm.bat create-config --user=admin --password-file=.password --http-port=8082 --server-name=sriramn php
CLI201 Command 'create-config' ran successfully

C:\\Program Files\\Sun\\WebServer7> bin\\wadm.bat create-instance --user=admin --password-file=.password --config=php sriramn.red.iplanet.com
CLI201 Command 'create-instance' ran successfully

Unpack the download phppack for Web Server 7.0 under 'plugins' directory

C:\\Program Files\\Sun\\WebServer7> unzip c:\\downloads\\phppack-5_2_0-windows.zip

Invoke the PHP Add-on installer :
 
C:\\Program Files\\Sun\\WebServer7> cd plugins\\php

C:\\Program Files\\Sun\\WebServer7\\plugins\\php>setupPHP.bat -instancename=https-php


- Now, let us verify if you are able to execute PHP scripts. So, let us write a quick one like

<?php
 echo phpinfo();
?>

and save this one with the name under 'info.php' under your server's document root directory

- Start the instance (https-php\\bin\\startserv.bat) and try accessing the info.php web page

- If you are satisfied with what you see, then you can bring over these recent configuration changes into Administration Server's configuration repository by running the following command



C:\\Program Files\\Sun\\WebServer7\\plugins\\php>cd ..\\..\\

C:\\Program Files\\Sun\\WebServer7>bin\\wadm.bat pull-config --user=admin --password-file=.password --config=php sriramn.red.iplanet.com
CLI201 Command 'pull-config' ran successfully



- Now, use your favorite browser to access 7.0 Administration Console  (https://<HOSTNAME>:<PORT>;)

- At the top right, you will see something like 'Deployment Pending'. Click this button

- This should open a pop up window and provide you with 2 choices
    - first one is when you want to bring over the configuration changes that already exists in the administration server's configuration repository but needs to brought down to an instance.
    - second one is when you have made some changes to your local instance either by manually editing the configuration files or by running scripts like 'setupPHP' and you want administration server configuration repository to know about this.

- In this case, we will select the 2nd radio button as our choice, and click 'Deploy'.

- If you are thinking of going live with these bits, then you defintely want to configure a 'php.ini' under '<WebServer Install Root>/plugins/php' directory. The Add-on does come with the standard 'php.ini-dist' and 'php.ini-recommended' for reference purposes.  Please take time to create a php.ini that suites your needs.

Please let us know as to what you think. As usual, you can post your experiences and pain points to our Forum


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Sharing what little I know

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today