Thursday Jul 30, 2009

Check out Web Stack Enterprise Manager within Web Stack 1.5

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

GlassFish Web Stack 1.5 is available now ..

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.

Thursday Jul 16, 2009

How to share data between Mac OS X(host) and OpenSolaris(guest)

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.


Running PHP as CGI in OpenSolaris 2009.06

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

Web Stack@CommunityOne West (1st June'2009 - 2nd June'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

DTrace probes within MySQL 5.1 in OpenSolaris Web Stack

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

How to check your APC / Memcache performance statistics ...

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.


Sunday Apr 05, 2009

New DTrace probes within PHP in OpenSolaris 2009.06

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

Configuring Sun Web Server 7 with PHP runtime in OpenSolaris

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.

PHP 5.2.9 is now available within OpenSolaris 2009.06

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. If you would like to try out the latest runtime, feel free to check out the OpenSolaris 2009.06 preview build 110 or above.

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.

Upgrdaing OpenSolaris 2008.11 to OpenSolaris 2009.06 (preview build)

If you already use OpenSolaris 2008.11, then you can upgrade to the latest development builds of OpenSolaris 2009.06 by following these instructions :

Open a command line window by selecting Applications->Accessories->Terminal icon.

pfexec pkg set-authority -P -O http://pkg.opensolaris.org/dev opensolaris.org

pfexec pkg image-update

pfexec init 6 (this will restart the system)

Assuming you have successfully installed or upgraded OpenSolaris 2009.06 (preview build) - either on bare metal or using one of the virtualization solutions like VirtualBox , now you will need to download PHP runtime from the OpenSolaris repository. As usual, let us do this using the command line window.

Note: OpenSolaris distribution does have a nice GUI to download packages - known as PackageManager - available within System->Administration->PackageManager - from the repository.  Hey - I am command line person.So, I prefer doing this one liner rather than going through some buttons in GUI. Now, if you are a GUI person, you are reading the wrong blog !

Okay, here is the one line that you will need to run from your command line window

[sriramn@sriramn]:sriramn> pfexec pkg install amp

Stay tuned for the list of features added within AMP stack (Apache, PHP and MySQL) for the upcoming OpenSolaris 2009.06 distribution.

Tuesday Mar 03, 2009

OpenSolaris 2008.11 based AMP stack is now available for Amazon EC2

After a long time since my initial post on releasing the OpenSolaris based AMP stack for Amazon EC, Today, we announced the availability of Amazon Machine Image (AMI) for OpenSolaris 2008.11 based AMP (Apache 2.2, MySQL 5.0 and PHP 5.2) on Amazon EC2 envionment. So, if you want to try out Amazon based web services running on enterprise grade OpenSolaris, please check out this announcement for more information.



Monday Feb 09, 2009

Alternate ways of getting pecl extensions to work in OpenSolaris

Earlier, I wrote this blog on how to use PECL extensions within OpenSolaris. Now, there will be some scenario where in a simple pecl install <extension name> might not work because of how the script might have been written or what external dependencies like it depends etc.

For example, if you wanted to get mailparse PECL extension working within opensolaris, you would obviously try the following command first

pfexec /usr/php/bin/pecl install mailparse


and would probably be scratching your head when you run into the below error ...

bash-3.2# /usr/php/bin/pecl install mailparse
downloading mailparse-2.1.4.tar ...                                                                                                                                                                                                         
Starting to download mailparse-2.1.4.tar (Unknown size)
........................................done: 188,416 bytes                                                                                                                                                                                 
9 source files, building
running: phpize                                                                                                                                                                                                                             
Configuring for:
PHP Api Version:         20041225                                                                                                                                                                                                           
Zend Module Api No:      20060613
Zend Extension Api No:   220060519                                                                                                                                                                                                          
building in /var/tmp/pear-build-defaultuser/mailparse-2.1.4
...

checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. 

What the above error means that while PECL framework trying to build the mailparse extension , it is looking for a tool known as 're2c' (which is internally used by PHP). Unfortunately, this tool has not yet made its ways into OpenSolaris yet. I am pretty sure, this tool will soon make its way into OpenSolaris repository as well..

Okay, in these scenario, here is another quickie to get things going for you...

  • Within your OpenSolaris machine, manually download mailparse extension from PECL repository
  • run /usr/php/bin/phpize , followed by configure and build command.

[sriramn@sriramn]'~'>gunzip -c mailparse-1.1.4.tar.gz | tar xvfp -
[sriramn@sriramn]'~'> cd mailparse-1.1.4
[sriramn@sriramn]'~'>/usr/php/bin/phpize
[sriramn@sriramn]'~'>./configure --with-php-config=/usr/php/bin/php-config && gmake && gmake install


Now, mailparse extension should be available under /var/php/5.2/modules directory. If you would like to include any mailparse specific extension, you will need to define them within /etc/php/5.2/php.ini

Af course, for Apache/PHP module to load these new extensions, you will need to restart Apache/PHP server by doing some thing like.. I am sure, you know this already :-)

svcadm restart http:apache22

Using PEAR/PECL extensions within OpenSolaris

I ran into couple of questions by OpenSolaris users (unfortunately posted at various different places) wondering as to how to use PHP extensions either PEAR or PECL based extensions within OpenSolaris. In OpenSolaris, say to download and install - say any PECL extension, one would do some thing like

 

sriramn@sriramn:$ pfexec /usr/php/bin/pecl install <extension name>

The downloaded and installed extensions will be available at /var/php/5.2/modules location. 

Note: If any PECL extension depends on any third party library to be available on the system, please make sure that those libraries first exist on OpenSolaris by searching OpenSolaris pkg database

Similarly, if you would like to the most popular XML Parser PEAR extension within your application, you could simply run the following command..

sriramn@sriramn:$ pfexec /usr/php/bin/pear install XML_Parser

Lessons learnt with OpenSolaris 2008.11

Couple of weeks back, for some weird reason my desktop (running on OpenSolaris 2008.11) failed to boot successfully.  After some digging into the boot log files, it turned out that hald daemon does not want to start and this failed service is causing other dependent services to fail as well. I was charging my Palm Treo cell phone through USB within my OpenSolaris 2008.11 based workstation before it happened. Not sure, if it had anything to do with it. Once I recover my system, I will need to try it again to see if that is what kept the system from booting up successfully..

Since, this is my primary workstation, I decided to quickly restore my workstation using some of the tools provided by OpenSolaris 2008.11. Hope, some one wanting to recover their installation finds this useful.

One of the advantage(s) of OpenSolaris 2008.11 is that it uses the power of ZFS intrinsically to provide us with the ability to take a snapshot and rollback to the previous , if necessary. For example, OpenSolaris Boot Environment Manager (beadm(1M)Image Package Manager tool - pkg(1M) - instantly takes a ZFS snapshot of your boot environment and installation files after every successful operation. This allows us  to roll back to the snap shot if we screw some thing up and want to restore to previous state.

Now, in my case, I booted my system in single user mode and checked out the list of snapshots available for my boot environment by running the following command:

sriramn@sriramn:~$ pfexec beadm list -s

(-s informs beadm command to provide the list of snapshots)

(I was doing all this in single user mode. So, I haven't written down the output here.. )

Now, in my case, I was not able to use those snapshot(s) because I had upgraded my zpool to run on newer version of kernel. If I hand't upgraded my zpool , I could have simply done some thing like 

sriramn@sriramn:~$ pfexec beadm create -e opensolaris@install opensolaris-1

sriramn@sriramn:~$ pfexec beadm activate opensolaris-1

sriramn@sriramn:~$ pfexec init 6

Well, in any case, this is what I had to do to recover my system

  • Use OpenSolaris 2008.11 LiveCD to boot up my system. Unforuntately, OpenSolaris LiveCD based installer does not allow one to do reinstallation.So, I had to backup my home directory (using zfs send along with zfs receive ) before proceeding to install.
  • Opened a command line terminal window to back up my home directory to an external hard disk by doing some thing like

  • sriramn@sriramn:~$ pfexec zpool import -f rpool (this is where my corrupted opensolaris installation along with my home directory exists)

    sriramn@sriramn:~$ pfexec zfs list

    (above command should list all the dataset that is available in the pool. You could use this information to determine which one to be backed up). 

           NAME                               USED  AVAIL  REFER  MOUNTPOINT
           rpool/export                         69.9G   144G    19K  /export
           rpool/export/home                    69.9G   144G  2.22G  /export/home
           rpool/export/home/sriramn            67.7G   144G  66.6G  /export/home/sriramn

    sriramn@sriramn:~$ pfexec zfs snapshot rpool/export/home/sriramn@jan09

    sriramn@sriramn:~$ pfexec zfs send rpool/export/home/sriramn@jan09 | gzip > /mnt/backupfile.gz

  • Finally, I had to start a new installation by clicking on 'Install Now' icon. Once the system came up successfully, I simply recovered my old data by running the following command

<my external had disk is mounted as /mnt where I have saved a ZFS stream of my home directory to /mnt>
sriramn@sriramn:~$ gunzip -c /mnt/backupfile.gz | pfexec /usr/sbin/zfs recv rpool/export/home/sriramn@jan09


Thought, I would capture some of the lessons that I have learnt during this recovery experience...
  • Think twice before running 'zpool update' on your OpenSolaris 200[8-9].xx based desktop.  Why ?
    • Within OpenSolaris, invoking zpool upgrade command ensures that your disk pool is instantly converted to run on newer version of ZFS there by supporting the newer features of ZFS. However, older version of OpenSolaris kernel will not be able to read your data any more. 
    • If you would like to know what is in each version of ZFS, you could simply run the following command from the command line
      • pfexec /usr/sbin/zpool upgrade -v
    • For example, with OpenSolaris 2008.11 (build 101b), released version of ZFS is version 13 and with the latest released Nevada build 106, ZFS version is 14 !. Now, let us say, if you update your system to run on Nevada build 106, and then you explicitly invoked zpool upgrade , now you will not be able to use your OpenSolaris 2008.11 LiveCD and access your home directory !
  • Take regular snapshot of your file system as well as boot environment because unlike other platforms, snapshots on ZFS doesn't cost that much in space and the benefits are huge.. OpenSolaris installer automatically create a '@install' snapshot of the boot environment as well as the files created as part of an installation. This is very cool. This would allow us to revert back to this snapshot any time some thing gets messed up.

Wednesday Feb 04, 2009

NetBeans 6.5 includes plugin for Sun Java System Web Server 7

NetBeans 6.5 is an awesome release. Since then, I have been eagerly awaiting for Web Server 7 plugin within NetBeans 6.5 so that I can directly deploy my web applications on to  Sun Java System Web Server 7 through NetBeans IDE itself.  Today, I was pleasantly surprised to see an email from my colleague confirming that NetBeans plugin for Sun Java System Web Server 7 has been updated to support NetBeans 6.5 !!!.  Cool. 

If you use NetBeans and Web Server 7 for your web application development then you can download this plugin by selecting Tools -> Plugins and then clicking on Available Plugins tab. 

Tuesday Jan 13, 2009

Sun Java System Web Server is now available as Open Web Server !

As I mentioned earlier in this blog, Sun followed up on its earlier announcement and  released the core kernel  of Sun Java System Web Server  as Open Web Server under BSD license !. Open Web Server has found its new home under OpenSolaris Web Stack project  where in we intend to continue developing this beast.  

If you wonder, what is available within Open Web Server, check out this feature comparison chart between Sun Java System Web Server and Open Web Server .

Now, if you would like to build and try out this beast - check out Open Web Server Build Instructions which currently provides instructions on what it takes to build this beast on platforms like Fedora, Debian, openSuSE, Ubuntu and OpenSolaris.

Monday Jan 12, 2009

What's new with AMP stack in OpenSolaris 2008.11

If you are new to OpenSolaris, please check out this blog on how to get the AMP stack for this platform. 

Since the initial release of OpenSolaris 2008.05 - in the last 4-5 months -  our Web Stack project team has been busy revving up AMP (Apache, MySQL and PHP) stack specific bugs for OpenSolaris 2008.11 as well as porting this stack on Solaris 10 and RedHat Enterprise Linux 5 platforms as part of Sun Web Stack 1.4 release. For more information on this Sun Web Stack 1.4 release, check out this blog from my colleague - Jyri Virkki.

Now, in this blog, I thought I will write some of the important technical issues that has been addressed within AMP stack  for OpenSolaris 2008.11 release.

  1. General version update of AMP components like Apache = 2.2.9, PHP = 5.2.6 and MySQL = 5.0.67.
  2. Apache and PHP configuration files have been updated to provide better performance out of the box.
  3. Apache 2.2.9 now includes additional modules like Perl, FastCGI, DTrace etc
  4. Apache now provides various sample configurations like SSL configuration within /etc/apache2/2.2/samples-conf.d directory. 
  5. MySQL 5.0 server (64-bit) is also now available . However, MySQL server defaults to 32-bit by default. If you would like to run MySQL server as 64-bit, please refer to Administering MySQL server documentation within our wiki.
  6. Experimental MySQL 5.1 server is now available within webstack repository. However, to use MySQL 5.1 within OpenSolaris 2008.11, you will need to explicitly point to Web Stack repository to download and install this server. I guess, more on this in a separate blog !
  7. PHP file layout has been modified to be more in synchronization with the rest of the components. New PHP 5.2.6 file layout within OpenSolaris 2008.11 is /usr/php/5.2 - for all standard binaries, /etc/php/5.2 - for all configuration and /var/php/5.2 - for all data, pecl / pear modules and session specific contents. Also, at the time of startup , PHP engine will look and load all the INI files found under /etc/php/5.2/conf.d directory.
  8. PHP extensions like APC, DTrace is now enabled by default. Also, PECL extensions like XDebug, Memcache, Suhosin, idn and tcpwrap is bundled within OpenSolaris 2008.11. However, they are disabled by default. These extensions are bundled as individual ini files within /etc/php/5.2/conf.d directory.
  9. Individual PHP extensions can be either enabled or disabled by editing their corresponding ini files within /etc/php/5.2/conf.d directory and then restarting Apache SMF service. For more information on restarting Apache SMF service, please visit our Administering Apache Server documentation within our Web Stack Wiki.
  10. PHP extension now includes PEAR / PECL support as well. So, now it should be easy for developers to now download and install their favorite extensions. So, if you wonder as to how to use PEAR or PECL within OpenSolaris, you could do some thing like below
    1. /usr/php/bin/pear install XML_Parser
    2. /usr/php/bin/pecl install inclued

Now, if you install these PECL extensions as shown above, please remember to enable them by editing the php.ini found within /etc/php/5.2/php.ini  location.

You can load any of these PECL php extensions by editing php.ini and adding the following line at the end of the file

extension = [extension name].so

Note: Please note that unlike Linux or other platforms, Solaris engineering folks would like to avoid writing any user data (like data not provided by OS) within /usr location. So, we don't write any dynamic data into /usr. So, what this means is - PEAR or PECL will now install modules under /var/php/5.2/modules directory. However, PHP engine has been patched to look for modules both under /usr/php/5.2/modules as well as /var/php/5.2/modules directory

Hopefully, this acts as a good starting point on what to expect with AMP stack in OpenSolaris 2008.11. For more comprehensive information, please visit our Getting Started Guide or please visit your feedback within our OpenSolaris Web Stack forum .

Setting up AMP Stack within OpenSolaris

With the first release of OpenSolaris - OpenSolaris 2008.05 -  I wrote this and this and this blog on how to use AMP stack for this platform. Well, these blogs very much holds true for the latest release of OpenSolaris - OpenSolaris 2008.11 .

However, OpenSolaris 2008.11 includes a nice GUI application known as Package Manager  is available which further simplifies the process of downloading and configuring software applications that are available within its software repository.  

Let us use this application in this blog to see how easy it is to get an AMP (Apache, PHP and MySQL) stack going on your OpenSolaris 2008.11.

Assuming you have successfully installed opensolaris , let us start Package Manager as shown here

Now, you will need to choose whether you need either 

  • amp -  only the Apache 2.2.8 2.2.9, PHP 5.2.6 and MySQL 5.0.65 5.0.67 runtime
  • amp-dev  -  complete development environment and its tools like cvs, subversion, netbeans along with amp runtime

 and any other software packages that you are interested and click on Install / Update. 

Before Package Manager actually installs the packages on your system, you will get another chance to review your selection like below.

Now, click on Next should start the installation process. That should all be required to complete the installation of AMP runtime stack for OpenSolaris.  

Finally, if you are a GUI person and would prefer a GUI way to start/stop Apache and MySQL services as well as to edit your Apache configuration files then you might want to initialize the Web Stack environment as shown below

 and will need to enter your 'root' password for the initialization to complete. 

Now, if you are a command line person - like myself, you can manage your Apache and MySQL SMF service as below

  • For starting Apache and MySQL service, open a command line window and run the following command

    pfexec /usr/sbin/svcadm enable http:apache22

    pfexec /usr/sbin/svcadm enable mysql:version_50

  • Similarly, for stopping these services, run the following command:

    pfexec /usr/sbin/svcadm disable http:apache22

    pfexec /usr/sbin/svcadm disable mysql:version_50

If in case, you wonder what is SMF - you might wanna check out Service Management Facility project page for more information on how this is useful to you.  

Finally, if you run into any issues, you can check out our  Getting Started Guide or our Web Stack wiki or  feel free to post your issues at our  Web Stack forum page. 


Tuesday Sep 02, 2008

OpenSolaris Web Stack images are now available on Amazon EC2

If you want to quickly host a website running on Joomla or Drupal - or even a wiki based on MediaWiki  - on enterprise quality OS like OpenSolaris- that too without any initial overhead investment (sounds too good to be true ?) - check out our recently uploaded 32-bit OpenSolaris 2008.05 based images for Amazon Elastic Cloud Computing (EC2) environment. Some time back , I mentioned here on the different ways to try out OpenSolaris . Now, these AMI's  allows you to try out cool features within OpenSolaris like ZFS, DTrace, IPS even without a Live CD...

If you are already an Amazon EC2 customer or familiar with Amazon's cloud offering - you can skip these introductions and head out to the list of OpenSolaris based Amazon machine images(AMI).Read on for a quick intro on Amazon EC2 and how to get started..

How to get started with Amazon EC2:

  • Visit Amazon Elastic Compute Cloud (EC2) web site for information on pricing as well as to open Amazon Web Services account and to sign up for Amazon EC2 web service.
  • Check out Amazon EC2 Getting Started Guide for detailed setup instructions. You might also want to check out 'Introduction and FAQ' forum posting on Amazon Web Services developer forums
  • Now, you will need to register with Sun to get access to 32-bit OpenSolaris images by filling this form.
  • Finally, you can use Amazon EC2 tools as described within Getting Started Guide to launch these 32-bit OpenSolaris AMI's.

 


 


Wednesday Jul 23, 2008

Sun announces open sourcing of its premier Web Server product line...

I am excited to share the good news that Sun today announced its decision to open source the core kernel of Sun Java System Web Server under BSD license

If you wonder as to  why are we doing this  , here are the top reasons that come to my mind.

  • Sun's new found open source love !!!  The recently open sourced products from Sun like OpenJDK, OpenSolaris, Netbeans, GlassFish to name a few, have all been adopted very well within the open source community.
  • I guess, Sun understands that there is still lot more innovation to happen within the 'Web Server' land and wants to be a part of this by sharing its innovation / IP within the rest of  the open source community. This step should trigger cross pollination within other popular open source web servers like Apache HTTP server and LightHTTPd. Note that Sun wants to partner with these open source communities and not compete with them !.

If you have never head of Sun Java System Web Server ever before (it is sad but definitely possible) then you might be wondering as to what the heck is this Sun Web Server product. So, here is a brief history of the product line :

  • Introduced to the world as Netscape Enterprise Web Server from Netscape Communications Inc in early 1997
  • Sun partnered with Netscape Communications in late 1990's and early 2000's and released iPlanet Enterprise Server 6.x release
  • Since Netscape went away, Sun has continuously invested in enhancing the scalability side of its product line and released Sun Java System (for a brief time also known as Sun ONE) Web Server 6.1
  • Over the last 2 years, Sun used its Sun Java System Web Server 6.1 , 7.0 Update 3 and Solaris 10 products to demonstrate the scalability, performance/watt of its Sun Fire T2000/T5120 servers by repeatedly holding SpecWeb'2005 world record. You can get more information about these world records from here, here and here
  • Since fall of 2006, Sun has made its Web Server free to use - both in development as well as in production. Af course, paid customers have enjoyed production support, urgent bug fixes and indemnification. Now, this will continue to be the same even after today's decision.

Now that the great decision has been made, we - engineers - can go back to our kennel and work on the actual job of putting together a build system so that every one can build and play with it. Hopefully, you guys will be able to download the source and use it before fall'08.

Meanwhile, you are more than welcome to download Sun Java System Web Server and use it for free from here.

About

Sharing what little I know

Search

Archives
« July 2015
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
31
 
       
Today