Deploying PHP (from Cool Stack 1.2) with Sun Web Server 7
By sriram on Nov 02, 2007
I am sure, some of you already used Cool Stack for deploying your web application on Solaris. . If you haven't , then you might be very interested in knowing that Sun's Cool Stack highly optimizes various open source components like Apache 2, PHP5, Ruby, Light HTTPd so that these components can perform optimally on Solaris 10 or greater. Cool Stack engineering team has just released their latest release - Cool Stack 1.2 . If you would like to leverage the benefits of Solaris 10 and deploy your web applications (AMP stack) on Solaris, then kindly check out Cool Stack 1.2 release from their web site.
I personally like PHP5 runtime bundled with Cool Stack 1.2 as it now includes FastCGI support besides having the ability to work with whole lot of databases like Oracle, MySQL, PostgreSQL etc. Now, having FastCGI support within PHP5 runtime allows PHP applications to be deployed on top of web servers like Sun Java System Web Server 7 or with Apache 2 worker MPM.
Because of my involvment with Sun's Web Server 7 engineering , naturally I am very interested in finding out how to help our customers deploy their PHP application on top of Web Server 7 using Cool Stack's PHP runtime. This way, customers can enjoy the performance benefit of using the highly scalable Web Server 7 with optimized Cool Stack PHP5 for their PHP based applications.
Here is a quick run through on the steps involved in deploying the Cool Stack's PHP runtime within Sun Java System Web Server 7
Installing and Configuring Web Server 7
- If you haven't already, you can download and deploy Web Server 7 for free from here. You might also be interested in checking out the 'What's new in this release' to find out more about how this high performing and enterprise ready Web Server . Here is a useful Screencast (if you would like to) and Getting Started guide.
- Now, me being a command line person, I am leveraging Web Server 7 Administration server's command line interface here. If command line is not your cup of tea, you can also use the administration GUI (browser based) to do these steps.
Note: This below step is very much optional. Web Server 7 installation provides you with a default configuration. You can choose to use the already existing configuration, if you prefer so.
Let us start the Administration Server and create a new configuration cum instance here. For testing purposes, in this example, I am creating a new configuration to run this server at port 8080 on my local machine(sriramn)
/sun/webserver7> bin/wadm create-config --user=admin --http-port=8080 --server-name=sriramn.red.iplanet.com coolstack
/sun/webserver7> bin/wadm create-instance --user=admin --config=coolstack sriramn.red.iplanet.com
Installing Cool Stack 1.2
- You will need to visit either Sun's Cool Stack web page or download the Cool Stack 1.2 release from here. (You will need to login Sun's Online Account to successfully download Cool Stack 1.2 release).
- In their downloads web page, you will need to select and download "Core Libraries (CSKruntime package)" and "Apache / PHP5 (CSKamp)" components.
Note: To successfully install Apache/PHP5 package on your system , you will need to download and install "Core Libraries(CSKruntime)" component as well. (Unfortunately, the downloads web page does not mention this information before hand. )
- Unzip the downloaded packages by doing some thing like
bunzip2 -f CSKruntime_1.2_sparc.pkg.gz
bunzip2 -f CSKamp_1.2_sparc.pkg.gz
Note: If you are using Solaris on Intel / AMD hardware, then you will need to download the "x86" version of these packages and accordingly the downloaded files will be 'CSKruntime_1.2_x86.pkg.bz2' and 'CSKamp_1.2_x86.pkg.bz2'
- You will need to become 'root' and install these packages by doing something like
For Solaris SPARC hardware
pkgadd -d CSKruntime_1.2_sparc.pkg
pkgadd -d CSKamp_1.2_sparc.pkg
For Solaris x86 hardware:
pkgadd -d CSKruntime_1.2_x86.pkg ( if you are using SolarisCSKruntime_1.2_x86.pkg if you are on Solaris x86)
pkgadd -d CSKamp_1.2_x86.pkg
Configuring Cool Stack 1.2 PHP with Web Server 7
- Once the package installs successfully, you could change your current directory and go to Cool Stack PHP5 installation location by doing some thing like 'cd /opt/coolstack/php5' on the command line.
- Within the Cool Stack 1.2 PHP5 installation location '/opt/coolstack/php5' , you should find a script with the name 'setup-ws7-php.sh'. Now, run this script by doing some thing like
and you should see a message box like this
This script will configure Coolstack PHP with Sun Java System Web Server 7
Here, you will need to provide the top level location of your Web Server 7
installation and your Web Server 7 instance_name name to which this script
should configure to run PHP scripts.
Enter your Web Server installation location(/sun/webserver7) :
- Follow the setup by providing the appropriate Web Server 7 installation location on your system. Obviously, this needs to refer to the location where you installed Web Server 7.
- Later, this script will require you to provide you with an Web Server instance name .Web Server instance name translates to a directory under your installation location containing all the necessary configuration file necessary for running your web site. If you are using Java Enterprise System 5 based Web Server, then your instances will be under /var/opt/SUNWwbsvr7.
- In our example, we will use the instance name 'https-coolstack' that was created using Web Server 7 Administration CLI at the beginning. If in case, you want to PHP enable a different instance, you can choose to provide another valid instance name here. The instance name that you provided to this script is now PHP enabled and now you can use Cool Stack 1.2 PHP within Web Server 7.
- Now, you should be able to start the Web Server 7 by doing some thing like
- In our case, we are now ready to create sample php files under /sun/webserver7/https-coolstack/docs
Kindly give it a spin and let us know what you think and how we can improve and thanks a bunch for reading !