Deploying PHP From Cool Stack in Sun Java System Web Server

By Sriram Natarajan and Marina Sum, November 27, 2007  

Cool Stack is, as defined on its site, "a collection of some of the most commonly used open-source applications optimized for the Solaris Operating System." If you have not deployed Web applications with Cool Stack before, be assured that it highly optimizes numerous open-source components such as Apache 2, PHP 5, Ruby, and Light HTTPD so that they can perform efficiently on the Solaris 10 OS or later releases. To take advantage of the Solaris OS benefits and deploy your Web applications (Apache, MySQL, and PHP—called AMP—stack) there, check out the newly available Cool Stack 1.2 release.

Besides supporting many databases (for example, Oracle, MySQL, and PostgreSQL), the PHP 5 runtime that is bundled with Cool Stack 1.2 also works with FastCGI. That means you can deploy PHP applications on top of Web servers like high-performing, enterprise-ready Sun Java System Web Server 7.0 (henceforth, Web Server). Deploying on Web Server nets you the performance benefit of its high scalability with optimized Cool Stack PHP 5—a win-win situation.

This article steps you through the deployment procedure.

Note: Type each of the command lines in this article on one line even though, because of screen-width constraints, some of them wrap to the next line.

Installing and Configuring Web Server
Installing Cool Stack
Configuring Cool Stack PHP With Web Server
Installing and Configuring Web Server

You can download and deploy Web Server for free. To learn more about its capabilities, see the "What's New in This Release" section in the Release Notes. Also of help are this custom installation screencast and Getting Started Guide .

The procedure that follows shows the steps in the Web Server Administration Server's command-line interface (CLI). You can also perform them from the browser-based administration GUI.

At installation, Web Server offers a default configuration. Optionally, you can create a configuration-cum-instance. To step through the deployment procedure, create one by following these steps:

  1. Start the Administration Server. Type:

    /sun/webserver7> admin-server/bin/startserv
  2. Create the configuration. Type:

    /sun/webserver7> bin/wadm create-config --user=admin --http-port=8080 coolstack
  3. Create the instance. Type:

    /sun/webserver7> bin/wadm create-instance --user=admin --config=coolstack
Installing Cool Stack

To install Cool Stack, do the following:

Note: You must first create a Sun account online and then log in to download.

  1. Download Cool Stack 1.2.

    On the downloads page, select and download the Core Libraries (CSKruntime package) and Apache-PHP 5 (CSKamp) components.
  2. Unzip the downloaded packages. Type, for example:

    bunzip2 -f CSKruntime_1.2_sparc.pkg.gz
    bunzip2 -f CSKamp_1.2_sparc.pkg.gz

    Note: If you are using Solaris OS on Intel or AMD hardware, download the x86 version of those packages, after which the downloaded files will be named CSKruntime_1.2_x86.pkg.bz2 and CSKamp_1.2_x86.pkg.bz2.
  3. Become root and install the packages.

    • For Solaris SPARC hardware, type:

      pkgadd -d CSKruntime_1.2_sparc.pkg
      pkgadd -d CSKamp_1.2_sparc.pkg

    • For Solaris x86 hardware, if you are using SolarisCSKruntime_1.2_x86.pkg, type:

      pkgadd -d CSKruntime_1.2_x86.pkg

      Otherwise, type:

      pkgadd -d CSKamp_1.2_x86.pkg
Configuring Cool Stack PHP With Web Server

Next, do the following:

  1. Go to the Cool Stack PHP 5 installation location. Type:

    cd /opt/coolstack/php5

    In that directory is a script called
  2. Run Type:


    This message is displayed:

    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):
  3. Type the full path for your Web Server installation.

The script then prompts you to type a Web Server instance name. That name is the path to a directory in your installation location—one that contains all the configuration files for running your Web site. If you are using Web Server in Sun Java Enterprise System 5, your instances are under /var/opt/SUNWwbsvr7.

For the example in this article, cite the instance https-coolstack that you created previously. To enable a different instance for PHP, type that instance name. Your instance is then ready for PHP, which you can deploy with Cool Stack 1.2 PHP on Web Server.

Finally, do the following:

  1. Start Web Server. Type:

  2. Create sample PHP files under /sun/webserver7/https-coolstack/docs.

Take it for a spin! We welcome your comments and suggestions.

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Java 8 banner (182)