Tuesday Feb 02, 2010

Recently, Sun published Sun Alert for recently discovered security vulnerability within Sun Web Server and immediately released updates to Web Server 7 and Web Server 6.1 release train to address these discovered vulnerabilities. 

If you are running Sun Java System / iPlanet / Sun ONE Web Server, we strongly urge to upgrade to this latest update. 

Thursday Dec 17, 2009

As a nice farewell for 2009, Web Server 7 engineering team announced the availability of Sun Web Server 7 Update 7 today. Web Server 7 Update 7 provides the following features / updates besides regular bug fixes.. For more information on this release, check out Release Notes . Here are some key features of this update:

  • Web Server 7.0 Update 7 introduces Kerberos/SPNEGO support.
  • Web Server 7.0 Update 7 supports Windows 2008 SP2 32 bit (x86) Enterprise Edition.
  • Web Server 7.0 Update 7 is integrated with NSS 3.12.5 which provides relief for the SSL/TLS renegotiation vulnerability (CVE-2009-3555) . Please refer to Jyri's blog on Web Server 7 and TLS vulnerability to learn more on this. 
  • Web Server 7 Update 7 now bundles Sun JDK 7 Update 17 on Solaris, Linux and Windows.

Monday Dec 07, 2009

On the topic of debuggers, here are some of my top most pet peeve when it comes to debuggers..

DBX

* Hate pressing n every time to go to next line. For some reason, Sun Studio folks never provided a alias to 'Enter' key like the way we do have on GDB.

GDB

* There is no nice way to display complex structures . For example, if you want to display a nested structure with some nested union / structure in it, good luck deciphering them. DBX's print does an excellent job on this .

* Surprisingly for such a vibrant open source community, still there is no simple way to save your break points. If you need to save your breakpoints so that when you quit gdb and want to run again, you still need to do complex steps like

(gdb) info breakpoints

and  manually  copy the last column to some file or .gdbinit .

Come on, we are now living in Web 2.0 era where there is API's for every thing and at the least I would expect some thing like

(gdb) save-breakpoints.

Af course, one can write kludge macros to save your breakpoints etc.But, that is not elegant though... For some unknown reason, got into ranting mode. Ok, time to dump your head into your debugger..


Didn't realize that GDB had an option called 'commands' to execute extra commands after hitting a break point. That is pretty cool. For example, I can now do some thing like



(gdb) b <function name> if ($data)

(gdb) commands <breakpoint-number>
Type commands for when breakpoint 7 is hit, one per line.
End with a line saying just "end".

commands

silent

print $data

cont

end

 Af course, if you are using DBX on Solaris/OpenSolaris,you would do some thing like when { shell statements } .. Hope this helps some one..

Monday Oct 12, 2009

I am proposing a talk in Zend Unconference'09 on the benefits of using DTrace within PHP. If you are attending ZendCon'09 or interested in hearing more on dynamic tracing within PHP, please vote for this talk by visiting here.  Thanks for your support. Here are some of my previous posts on this subject

 Hope to see you in ZendUnCon'09

Wednesday Sep 30, 2009

If you didn't know already, GlassFish Web Stack is an open source project within OpenSolaris and offers production support (also available as free download) for open source web tier components like Apache Web Server, PHPMySQL, Tomcat, Hudson etc on Solaris 10 Update 5 (or above) and on RedHat Enterprise Linux 5.2 (or above). Our latest release - Web Stack 1.5 is currently available for download and for more information on this product, kindly check out my earlier post.

Our next version Web Stack 1.6 is in active development and if you would like to follow up our development, you can do so as shown here. Web Stack 1.6 will include component version upgrade for components like PHP, Apache, MySQL, Ruby, Memcached.  With development build 1, PHP 5.2.11 Apache 2.2.13 have been integrated. 

Please note : This development builds are in active development and has not been through any testing. So, this development builds will most likely will have bugs and are meant only for testing purposes.

How to get Web Stack 1.6 Development build ?

GlassFish Web Stack 1.5 release is available either as

  • installation via native packages (SVR4 Packages for Solaris 10 and RPM for RHEL5.2). This is typically the preferred way in large enterprises. This installation will require root privileges and provides integration with Solaris 10 SMF etc.

  • installation via IPS (Image Packaging System) also known as 'Update Center'. This installation is typically preferred by developers and in enterprises where you have access to internet to download and install binaries from internet on your production machine !. This installation does not require 'root' privileges and all files (including web server document root and MySQL data directory) is configured under your installation directory. So, you might find it very intuitive to install, use , develop and even take it with you.

Currently, our development builds are available only through 'Update Center'. 

Installing Web Stack 1.6 (development builds) as IPS (Update Center)

IPS (Image Packaging System) is an open source technology built on Python and is the core underlying framework on how packages are delivered within OpenSolaris. This work was initially done for OpenSolaris.  Now, as with any open source projects, another open source project - Update Center has successfully ported this work for platforms like Solaris 10 and Linux.

Now, GlassFish Web Stack 1.5 release uses this Update Center open source project to deliver a minimal Python runtime and Update Center technology as part of initial download. Then you will need to fire up the Update tool GUI to download and install components that interests you.

Unlike OS native packages, Update Center technology does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

Here is a quick walk through on how to get your AMP stack up and running with this: 

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link
  • Now, you will need to unzip the downloaded tar ball and fire up the update tool GUI. You will need to download some thing like

sriramn@sriramn:~$ unzip  webstack-image-1.5-b09-redhat-i586.zip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./bin/updatetool 

(Note: You will need GUI configured or DISPLAY set properly to successfully run the above command.)

(Note: If you do not have GUI/X11 configured on your Solaris / Linux machine, then you can do some thing like below to install

from command line.)

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -> to list all the component available


Now, firing up the GUI, will welcome you with a nice GUI like this below

Now, you will need to click on 'Edit Properties'  button and then 'Add Repository' and add the Repository URL to 'http://pkg.sun.com/layered/collection/dev'. 

    And then you will need to select this new repository as the default


Now, click 'Ok' and then select 'Available Add-ons'  to see all the new binaries that are available in this development repository. Now, you should be able to search Apache or PHP or MySQL and download the latest version. 

Note: Here, you will also find other Sun development binaries like GlassFish v3 etc.  



Wednesday Aug 26, 2009

During recent OSCON'09 conference, Jack Adams met with me to discuss on the ways to troubleshoot the problems with his web site. Check out this video.

A Jack Adams conversation with Sriram Natarajan, at OSCON 2009.

References: 

Sunday Aug 23, 2009

If you are one of those geeky folks using Sun Web Server (also known as Sun Java System Web Server , Sun ONE Web Server, iPlanet Web Server, Netscape Enterprise Server - Hmm... lot of incarnations) in your enterprise server with multiple cluster deployment or simply running a secure web server from your garage, you should be pleased to know that Amazon is now carrying this title  Sun Web Server: The Essential Guide . Ah, you know, what is more cool - Amazon Kindle carries this title as well. If you are one of those lucky few having a Kindle, you can get this instantly (ok, not that instant - probably in under 2 minutes) from here .

We love to hear what you think of this book. Please feel free to write to us at our Forum

Wednesday Aug 05, 2009

Some time back, I wrote this blog on how to leverage the PHP runtime integrated within OpenSolaris and use it to run PHP applications within Sun Java System Web Server 7. Well, if you are currently using Sun Web Server 7 on Solaris 10 or RedHat / CentOS Linux and wondering if there is a more simplified way to get PHP working within Sun Web Server 7, then my today's topic might be of more use to you.

Installing Sun Web Server

Now, if you are new to Sun Web Server 7 and wonder why you need this beast, please do check out some of these  performance benchmark blogs within our wiki. 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 !.

Installing Sun GlassFish Web Stack PHP

If you haven't yet heard of Sun Web Stack or more confusingly known as Sun GlassFish Web Stack - is an open source project within OpenSolaris - known as  Web Stack project - offers free download and production support (as part of Sun GlassFish Portfolio) for open source web tier components like Apache Web Server, PHPMySQL, Tomcat, Hudson etc on Solaris 10 Update 5 (or above) and RedHat Enterprise Linux 5.2 (or above).

Here is a quick way to get Web Stack PHP installed on your Solaris 10 or RHEL 5. If you prefer a little hand holding, please refer to my earlier blog on the different ways to install Sun Web Stack (along with some screenshots to guide you along the way).

Here is a quick walk through on how to get your PHP runtime installed

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link for your respective OS.
  • Now, you will need to unzip the downloaded tar ball and either fire up the update tool GUI for installing PHP runtime (as shown in this blog) or simply install it in the command line as shown below:

sriramn@sriramn:~$ unzip  webstack-image-1.5-b09-redhat-i586.zip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg install sun-php52 sun-php52-apc

sriramn@sriramn:~/webstack1.5$ ./bin/setup-webstack

Note: If you are interested in other PHP optional packages like PHP MySQL connector or MySQL community package etc, you could get the list of packages available either from GUI or CLI. From CLI, you could do some thing like as shown below

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -a -> to list all the component available from our repository


Note:  Unlike OS native packages, IPS based installation (that you just did here) does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

How to get Web Stack PHP working within Sun Web Server 7 ?

Ok, Assuming you have successfully installed Web Server 7 and Sun Web Stack PHP on your system, here is a simple one liner configuration script that you can run to successfully configure Web Server 7 to execute PHP scripts .


sriramn@sriramn:~/webstack1.5$ ./php/5.2/samples/scripts/configure-sun-webserver --installroot=/home/sriramn/ws7 --instancename=https-<hostname>


Note: On Linux, because of a bug with the above script, please download this script and overwrite it over the default.

cp /tmp/configure-sun-webserver ~/webstack1.5/php/5.2/samples/scripts/

That is all there to it.

Now, you should be able to run php scripts under your web server's document root directory (which is typically <ws7-install-root>/https-<hostname>/docs/).

Note: In the above example, I have assumed that you will be installing both Web Server 7 and Web Stack PHP as the same user and you wanted to configure PHP runtime with the default instance (https-<hostname>) created by Web Server 7 installer. If in case, you would like to configure a separate instance for Web Server 7 then you could do the same either using Web Server 7 Administration CLI /GUI.  Here is a simple example of how to do so with CLI :



sriramn@sriramn:~/webserver7$ ./bin/wadm create-config --user=admin --http-port=80 --server-name=<ĥostname> php

sriramn@sriramn:~/webserver7$ ./bin/wadm disable-java --user=admin --config=php

sriramn@sriramn:~/webserver7$ ./bin/wadm create-instance --config=php <hostname.domainname>

sriramn@sriramn:~/webserver7$ ~/webstack1.5/php/5.2/samples/scripts/configure-sun-webserver --installroot=~/webserver7 --instancename=https-php

Friday Jul 31, 2009

 Thought, I would share some of my OSCON'09 , where I spent some of the last week representing Sun at our booth besides attending some very interesting sessions. Our team presented a session as well -  Web Stack - Next Generation Open Web Infrastructure. We had a nice presence at our booths . We talked about OpenSolaris, GlassFish Web Stack and even gave away couple of iPod as well (as you can see here -   Tim Bray graciously selected the winner for one of our iPod winner and  Kai Seidler stopped by to select the winner for our second iPod.)

Well, couple of very interesting things that I observed during my presence at our Sun booth - where I did have a chance to meet lot of OSCON attendees :

  • most common question put to me was  - do you know what is going to happen to you after Oracle acquisition ? Well, I guess, after a while I had these coming out of my lips even without realizing -  "Currently the acquisition hasn't completed yet. So, Sun and Oracle still continues to operate as a separate company etc and honestly I have no clue whatsoever."
  • When I talked about OpenSolaris 2009.06Web Stack project , Sun GlassFish Web StackWeb Stack Enterprise Manager and our latest Web Stack 1.5 release - the most common question I got was "Why do you GlassFish in your product name ? Is Sun GlassFish Web Stack Enterprise Manager same as GlassFish Enterprise Manager?" . Well, this is one of the other answers that I had to repeat myself hundreds of times (if not more) "Sun is currently selling support for our project (where we hope to make money) as part of GlassFish portfolio and I guess, hence our product's name got prefixed with such popular open source project like GlassFish .
  • Interestingly, lot of folks showed lot of interest in our Web Stack 1.5 release on Linux. Even some of them were wondering if our stack can run on Ubuntu. Honestly, I was quite surprised.

Besides, we had different Birds of Feather sessions too (and had some very good attendance for some of these BoF sessions...)

Some time, it was quite tiring but probably was well worth it.

Thursday Jul 30, 2009

Now that  Sun GlassFish Web Stack 1.5 release is done, let me walk you through the steps involved in setting up your AMP (Apache 2.2, MySQL 5.1 and PHP 5.2) stack working together. One of the other cool features of Sun GlassFish Web Stack 1.5 release , besides Web Stack Enterprise Manager, is its ability to support

  • installation via native packages (SVR4 Packages for Solaris 10 and RPM for RHEL5.2). This is typically the preferred way in large enterprises. This installation will require root privileges and provides integration with Solaris 10 SMF etc.
  • installation via IPS (Image Packaging System). This installation is typically preferred by developers and in enterprises where you have access to internet to download and install binaries from internet on your production machine !. This installation does not require 'root' privileges and all files (including web server document root and MySQL data directory) is configured under your installation directory. So, you might find it very intuitive to install, use , develop and even take it with you.

 Installing Web Stack 1.5 as a native package / rpm

  • Visit our Sun Web Stack 1.5 download page and 'click on Native components (does not include java component)' link to download our native packages. If you wonder, what is "java components" in this above link . Well, we refer "java components" as components like Tomcat, Hudson, GlassFish 2.1. Since, this blog is about setting up a PHP/MySQL based web site, you can reduce your carbon foot print by avoiding those extra bulky downloads..
  • unzip the downloaded tar ball and install by running the following command (you will need root privileges)

sriramn@sriramn:~$ sudo ./install amp

Now, if you are running on Solaris 10 and don't want to install on all local zones, then you could even do some thing like

sriramn@sriramn:~#  ./install -XG amp


For more information with related to this installation, please check out our Installation Guide. Once you have completed this installation, you might want to refer to our Getting Started Guide as to how to survive with our stack. This guide should help you with basic information like where to find our configuration files, how to start/stop servers etc.

Installing Web Stack 1.5 as IPS (Update Center)

IPS (Image Packaging System) is an open source technology built on Python and is the core underlying framework on how packages are delivered within OpenSolaris. This work was initially done for OpenSolaris.  Now, as with any open source projects, another open source project - Update Center has successfully ported this work for platforms like Solaris 10 and Linux.

Now, GlassFish Web Stack 1.5 release uses this Update Center open source project to deliver a minimal Python runtime and Update Center technology as part of initial download. Then you will need to fire up the Update tool GUI to download and install components that interests you.

Unlike OS native packages, Update Center technology does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

Here is a quick walk through on how to get your AMP stack up and running with this: 

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link
  • Now, you will need to unzip the downloaded tar ball and fire up the update tool GUI. You will need to download some thing like

sriramn@sriramn:~$ unzip  webstack-image-1.5-b09-redhat-i586.zip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./bin/updatetool 

(Note: You will need GUI configured or DISPLAY set properly to successfully run the above command.)

(Note: If you do not have GUI/X11 configured on your Solaris / Linux machine, then you can do some thing like below to install

from command line.)

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -> to list all the component available


Now, firing up the GUI, will welcome you with a nice GUI like this below

Now, you will need to click on 'Available Add-ons' to see all the Web Stack components listed (as shown below).

Note: If your company requires HTTP Proxy to be configured to access the internet, you will need to click on 'Preferences' windows and appropriately configure proxy information before proceeding any further.

Now, select Apache HTTP Server, PHP , PHP MySQL Connector, PHP APC and MySQL Community Server(5.1.30 version) components from this above list  and click on Install . You should see a confirmation window like below and if you see all the components that you need, click on 'Install' again. 

If you do not have GUI / X11 configured on your Solaris / Linux machine, then you could very well do some thing like below to install AMP stack from command line. 

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg list -a  -> to list all the component available

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg install sun-apache22 sun-php52 sun-php52-apc sun-mysql51 sun-php52-mysql -> to install and configure Apache, PHP and MySQL within your home directory.

sriramn@sriramn:~/webstack1.5$ ./bin/setup-webstack

At the end of this installation, you should have a fully configured Apache , PHP and MySQL runtime within your home directory/webstack1.5 directory.

You can now start the Apache and MySQL server by running the following command from your command line:

  sriramn@sriramn:~/webstack1.5$ ./bin/sun-apache22 start -> by default Apache should now run at port 10080

  sriramn@sriramn:~/webstack1.5$ ./bin/sun-mysql51 start -> by default MySQL server should now run at port 13306


Now, you should be able to install applications like Joomla, Drupal, MediaWiki by simply unzipping these applications under Apache document root (~/webstack1.5/var/apache2/2.2/htdocs) directory

 For example, installing applications like Joomla / Drupal or MediaWiki should simply involve going to Apache document root and unzipping the application and following through the installation process within your browser (http://localhost:10080/joomla etc)

  sriramn@sriramn:~/webstack1.5$ cd var/apache2/2.2/htdocs

  sriramn@sriramn:~/webstack1.5/var/apache2/2.2/htdocs$tar zxvf ~/tmp/joomla*.gz


Most of the open source components are designed to be built and installed on the same machine. So, building a stack and making it run on different machine takes a bit of work but getting the same stack to be installed at multiple locations takes lots and lots of work. Well, we are doing this release for the first time and would love to hear your feedback and this took us lots and lots of effort to get it right.

You will find all our start/stop scripts under ~/webstack1.5/bin/sun-* (or wherever you installed /bin). Similarly, you will find all the configuration files under ~/webstack1.5/etc/* (or wherever you installed /etc). 

Hope you like what you see . If you run into issues, we encourage you to write back to us at our Forum.

Now that GlassFish Web Stack 1.5 release is finally available for download, check out the highlight of this release - Enterprise Manager


Web Stack Enterprise Manager within Web Stack 1.5 offers the following benefits :
  •  Ability to start / stop / restart open source web tier components within Web Stack like Apache HTTP Server, Tomcat, MySQL 5.0/5.1, Squid, Lighttpd.
  • Ability to lay out monitoring statistics of all these components in graph form. You also move back in time within these graphs allowing you to understand the patten of your load etc.
Web Stack Enterprise Manager, unlike the rest of the Sun GlassFish Web Stack 1.5 release , comes with a 30 day evaluation license. You will need to call Sun and buy support for using it post evaluation period. Hey , gotta make money some where..

However, rest of the GlassFish Web Stack 1.5 release is free to download and use (even for your production needs). We hope, you will consider Sun for your production support requirements.  If you have any issues with using Web Stack, please post your issues to our Forum - where some of the developers lurk and will be happy to guide you.

Wednesday Jul 29, 2009

If you didn't know already, GlassFish Web Stack is an open source project within OpenSolaris and offers production support (also available as free download) for open source web tier components like Apache Web Server, PHPMySQL, Tomcat, Hudson etc on Solaris 10 Update 5 (or above) and on RedHat Enterprise Linux 5.2 (or above). 

GlassFish Web Stack 1.5 , the latest update in this series, is available as of today and includes updated version components along with Enterprise Administration / Monitoring capability. Please refer to our Getting Started Guide for more information on how to get  your site quickly up and running using GlassFish Web Stack .

Some of the highlights of this release are :

You can try out GlassFish Web Stack 1.5 from here. GlassFish Web Stack 1.5 component runtime  is available as a free download for Solaris and Redhat Enterprise Linux and we hope you will choose Sun for your production support requirements.

Friday Jul 17, 2009

If you haven't heard already, Sun xVM Virtual Box allows you to run Open Solaris on your laptop (and for free !) . However, for a long time, Virtual Box did not have a simple way to share data between your host (MacOS X/Linux/Windows) and OpenSolaris guest. Finally, after a long wait, Sun xVM Virtual Box now is able to successfully share data between these two.

Here is how I did it

Within your host machine (whether Mac OS X or Windows), you will need to open Virtual Box settings for your guest image and then click on Shared Folders and   select to a share a location that you would like to share.


.




Now, you will need to boot up Open Solaris as guest and will need to install the new guest additions. Here is how you can do so


a) From the top level Virtual Box menu, click on Devices and then click on Install Guest Additions. This will cause Virtual Box to mount Guest additions ISO image.

b) Now, open a command line terminal to install this new guest additions.

  • Before proceeding to install the new version of guest additions, let us check if there are any old versions already installed on the system

    • sriramn@opensolaris:-~$> pfexec pkginfo -i | grep SUNWvboxguest

    • If the above command returned any output, then you will need to remove the previous guest additions like :

    • sriramn@opensolaris:-~$> pfexec pkgrm SUNWvboxguest

  • Now, you will need to install the latest Virtual Box guest additions package. To do so, you will need to select 'Install Guest Additions..' item from VirtualBox -> Devices menu item.
    • sriramn@opensolaris:-~$> pfexec pkgadd -d  /media/VBOXADDITIONS*/VBoxSolarisAdditions.pkg

c) Depending upon your configuration, you might have to reboot your Open Solaris guest.

If you would like to try out Open Solaris on your laptop for the first time, then Virtual Box is a great way to do so. You can get latest builds of OpenSolaris from here and here is a nice screen cast on how to use Virtual Box.

d) Finally, you will need to run the following command within OpenSolaris guest to mount the location that you decided to share from your host (in my case, it is Mac OS's ~/Public ) directory.  I was able to do this as shown below




Also, if you would like this particular location to be mounted every time you boot your OpenSolaris guest, you could also add this below line to your /etc/



Now, if you need to copy any file from your OpenSolaris (guest) VM to your host machine , you could simply do something like

sriramn@opensoaris:~$ pfexec cp ~/Documents/foo  /Public/Drop\ Box/

Hope you find this useful.


As part of Web Stack project, we deliver an integrated AMP stack within OpenSolaris where Apache 2.2.x, PHP 5.2.x and MySQL 5.1 is integrated together to work seamlessly. In this environment,
  • Apache is configured to run in pre-fork model
  • PHP is loaded as a module (mod_php5) within Apache (pre-fork) MPM.
  • Apache (worker) MPM model is not supported with PHP.

This particular scenario will work great for majority of users.

However, if you are one of those minority folks, who is interested in running PHP as CGI say with Apache 2.2 (worker) MPM, then here is what you need to do :

Configure Apache Server to start in worker (MPM) mode. This should provide you with better performance. This is how you can run Apache 2.2 in worker mode within OpenSolaris.

sriramn@opensolaris:~$ svcadm disable -s http:apache22

sriramn@opensolaris:~$ svccfg -s setprop http:apache22 httpd/server_type=worker

sriramn@opensolaris:~$ svcadm refresh http:apache22

sriramn@opensolaris:~$ svcadm enable -s http:apache22

Af course, to actually see any performance improvement, you will need to copy mpm.conf from samples directory(/etc/apache2/2.2/samples-conf.d/mpm.conf) to  /etc/apache2/2.2/conf.d/mpm.conf  and then tune this file accordingly.

Now that we have got Apache 2.2 worker MPM configured, if you try to run any PHP script within your document root directory, you will notice that they don't work. This is because, PHP module is not loaded if Apache is configured to run in worker MPM. (Remember, PHP modules and different extensions are not completely thread safe.) .

Now to get PHP scripts working again, here is what I did :

Copy PHP CGI script to the Apache's cgi-bin directory

sriramn@opensolaris:~$ pfexec cp /usr/php/bin/php-cgi  /var/apache2/2.2/cgi-bin/

sriramn@opensolaris:~$ pfexec chown webservd:webservd /var/apache2/2.2/cgi-bin/php-cgi

Now, you might want to create a file under /etc/apache2/2.2/conf.d/php-cgi.conf with the below content

#Create a alias for every location where you want to keep your PHP script.
ScriptAlias /contents/ "/var/www/contents/"
ScriptAlias /drupal/  "/var/www/drupal/"
AddHandler  php-cgi  .php
Action          php-cgi  /cgi-bin/php-cgi
<Directory /var/www/contents/>    
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/drupal/>
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>

(updated above content to reflect the feedback received from Jeff's comments to my earlier blog. Thanks a lot, Jeff.)

Here's a better example:

# Create the Alias for every php application that you want to deploy

Alias /phpapp /var/www/contents/

Alias /drupal /var/www/drupal/

ScriptAlias /php-cgi /usr/php/5.2/bin/php-cgi

<⁞Directory /usr/php/5.2/bin/>
 Order allow,deny
 Allow from all
</Directory>

<Location "/phpapp">
 Order allow,deny
 Allow from all
 AddHandler php-cgi .php
 Action php-cgi /php-cgi
</Location>

<Location "/drupal">
 Order allow,deny
 Allow from all
 AddHandler php-cgi .php
 Action php-cgi /php-cgi
</Location>

Finally, you will need to restart the server to allow this above configuration to be loaded. Now, server should be ready to process any php files as 'cgi' script under /var/www/contents directory

Hope you find this useful.

Friday May 29, 2009

CommunityOne'2009 is a free event for developers and deployers using Open Source software technologies and tools. If you haven't registered yet, please register for your free pass and plan on spending June 01'2009(Monday) with us to learn how open source tools and technologies can simplify your business.

Web Stack team , responsible for integrating an optimized open source web tier components like Apache, PHP, MySQL, Memcached, Lighttpd, Ruby within Open Solaris and Solaris10 is delivering the following talks at CommunityOne'2009 (Moscone Centre, San Francisco).


View Larger Map

1. Lightning Talk 2 (Monday, June 01'2009 - 10:50 AM - 11:40 AM Hall E 135)

Ease of Use with Sun GlassFish Web Stack by Jeff Trawick

Sun GlassFish™ Web Stack Enterprise Manager: A Simple Yet Powerful Tool for Monitoring AMP Deployments - Praveen Chandrasekharan

2. Observing Applications with DTrace - - Angelo Rajadurai (Monday  June 01 2:40 - 3:30 PM Esplanade 305) 

This session provides a quick introduction to DTrace and demonstrates the use of DTrace to observe the entire web application on the AMP (Apache, MySQL 5.1 PHP 5.2.9) stack and JavaScript technology stack on Open Solaris. The session, which includes a lot of demos, is meant to help the attendees use DTrace in their work.

3. Lightning Talk 5 (Monday, June 01'2009 - 4:00 - 4:50 PM Esplanade 303)

OpenSolaris™ Operating System Web Stack : Introduce the integrated Web Stack within Open Solaris -  Murthy Chintalapati, Jeff Trawick and Jyri Virkki

PHP Web Application Development Made Easy with the OpenSolaris™ Web Stack and the NetBeans™ IDE - I plan to talk on how Netbeans IDE can simplify Web Application development - Sriram Natarajan

4. Web Stack Deep Dive (Wednesday, June 03'2009 - 1 - 5 PM Intercontinental Hotel, near Moscone West, San Francisco)

- Prepare to spend 3 hours to understand what we have been doing within Web Stack and what we plan to do going forward..


Monday Apr 27, 2009

With the recent release of OpenSolaris 2009.06 build 111a , you will notice that MySQL 5.1 is integrated within AMP meta cluster. What this means is that now after installing OpenSolaris 2009.06, you can now easily install MySQL 5.1, Apache 2.2.11 and PHP 5.2.9 components by using either Package Manager or running the following command from the command line window :

pfexec pkg install amp

For more back ground on how to install these components on OpenSolaris, check out my earlier this and this link.

DTrace probes within MySQL 5.1

One of the goals of Open Solaris Web Stack project , that I am currently involved with, has been to enhance the number of static probes within open source web tier components like Apache, MySQL, PHP and Ruby . This is to provide the web administrators with complete end to end "under the hood" monitoring functionality. With the upcoming release of OpenSolaris 2009.06, we are making more progress along these lines - now  MySQL 5.1 includes static DTrace probes that are back ported from MySQL 6.0 source tree. For detailed information on these probes, please refer to MySQL 6.0 DTrace probe reference. Similarly, PHP 5.2.9 within OpenSolaris PHP runtime also now includes enhanced static DTrace probes as well. Ah, if you wonder on the status of Ruby, Ruby DTrace probes is already integrated within Ruby in OpenSolaris !.

Coming back to MySQL 5.1 DTrace probe , the title of my blog today, I thought, it is worthwhile to mention some of the few probes that are made available for MyISAM Key cache (but is still undocumented..)

* keycache-read-start (filepath, bytes, mem_used, mem_free)  -> This probe is fired at the start of key cache read operation and provide the following arguments :

  1. filepath -> MyISAM index file
  2. bytes -> Size of the read request.
  3. memory used
  4. memory available

* keycache-read-done(mem_used, mem_free) -> This probe is fired at the end of keycache read operation.

* keycache-read-block(bytes) -> This probe is fired if MyISAM key cache performs a blocked read from key cache.

* keycache-read-hit / keycache-read-miss -> This probe is appropriately fired whether a given request is available within MyISAM key cache file .

* keycache-write-start(filepath, bytes, mem_used, mem_free) -> This probe is fired at the start of key cache write operation and provide the following arguments :

  1. filepath -> MyISAM index file
  2. bytes -> Size of the read request.
  3. memory used of the current key cache
  4. memory available

* keycache-write-block(bytes) -> This probe is fired while performing blocked key cache write operation. 

* keycache-write-end(mem_used, mem_free) -> This probe is fired at the end of keycache write operation.

Wednesday Apr 08, 2009

PHP runtime within OpenSolaris includes performance booster extensions like APC (PHP extension to cache the compiled PHP script) and Memcache (PHP extension to integrate with Memcached server) to deliver the best performance, out of the box,  for production environment. Now, with upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 111 or above), we have also have made it easy to check out the performance statistics of these extensions which should further help you in getting the maximum juice from your system.

Installing OpenSolaris 2009.06 (preview build)

If you haven't tried OpenSolaris distribution yet, you can pick up the latest OpenSolaris 2009.06 (preview build) ISO image from here. and steps to install AMP (Apache, PHP and MySQL) stack within OpenSolaris is covered in my earlier blog .

Assuming, you have got a working AMP stack on your system and an application like Joomla, Drupal, or MediaWiki working fine , then here is what you need to do to display the performance statistics of these extensions to your browser :


For displaying PHP APC statistics to the browser:

sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-apc-stats.conf /etc/apache2/2.2/conf.d/

sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-memcache-stats.conf /etc/apache2/2.2/conf.d/

sriramn@sriramn:~> svcadm restart http:apache22


Now, you should be able to access these statistics of APC and Memcache extensions by going to the http://localhost/stats/apc/ or http://localhost/stats/memcache/  respectively.

Tuning PHP APC

Once configured, APC statistics page , for example, would show this below page. 

This page should provide you with information as to how many PHP pages are cached and if the cache is getting missed etc. If you see frequent APC cache misses etc then you will need to appropriately increase APC shared memory size. You could do this and other APC configuration tuning by visiting PHP APC configuration page .

If you run into any issues, you could always write to us visiting at this link or by visiting our forum.


Monday Apr 06, 2009

Wez Furlong wrote a PECL extension to provide a DTrace probe within PHP more than 4 years back. As part of Web Stack project within OpenSolaris, this extension has been made available within Solaris 10 as well as in OpenSolaris distribution in the last year or so. 

Now, with the upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. See my earlier blog on this topic. Besides PHP version update, David Soria Parra - contributor within open source projects like Mercurial, PHP Web Stack has made  this (experimental) patch available to provide the following additional DTrace probes within PHP for this release :

* compile-file-entry / compile-file-return -> This proble wil fire whenever Zend engine need to compile a given PHP script and can provide information as to which PHP script is currently going through PHP compilation process along with start and end line number. Note: PHP engine within OpenSolaris includes APC PECL extension - which caches the compiled PHP script when requested again and hence this probe will not fire in that circumstance.

* function-entry / function-return -> This probe will fire whenever Zend engine is executing a PHP function and can provide information as to which PHP function along with its file name and line number is currently being executed by PHP Zend engine.

* execute-entry / execute-return -> This probe will fire while executing PHP script and can provide information as to which file, line number is currently being executed by PHP Zend engine.

* exception-thrown / exception-catched -> This probe gets fired whenever PHP runtime encounters an exception and can the classname when an exception is thrown.

* error -> This probe gets fired whenever PHP runtime throws an error and can provide information like the error message, file name in which the error happened and the corresponding line number.

* request-startup / request-shutdown  -> This probe gets fired at the start and end of processing a given PHP script and can provide the filename of the script , request URI . This should allow a given DTrace script to track the start and end of PHP script. 

Note:  this patch is under active development and will be further refined to add additional DTrace probes as well as to address any user reported issues. 

Considering that DTrace support is available for Mac as well as FreeBSD, I am sure, PHP community will be interested into looking into this patch as well.

Okay, so now, if you are interested in trying out OpenSolaris 2009.06 (preview build) and the updated AMP stack, check out my earlier  blog for detailed steps on this.

Here is a sample DTrace script that you can use as a reference point.

Friday Mar 27, 2009

With upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. Also, we have integrated a configuration script to simplify the steps required to configure PHP runtime with Sun Java System Web Server 7 (formerly known as Sun ONE/iPlanet Enterprise Server). Thought, I would you walk through the steps involved here

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=https-sriramn

  * 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

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Hope you will like our simplified integration and let us know with your feedback at our forum.

This blog copyright 2010 by natarajan